網頁

2013年3月29日 星期五

Set user shell using ssh script to linux base system and sudo problem.

I using ruby ssh library to linux server. then run sudo command.
like "sudo usermod -s /sbin/nologin Chien-Ming-Wang".


centos:
  Set user shell: sudo chsh -s /sbin/nologin [login name]
  When error: "sudo: sorry, you must have a tty to run sudo"
    vi /etc/sudoers
    mark line: "Defaults    requiretty"


Debian & Ubuntu:
  Set user shell: usermod -s /usr/sbin/nologin [login name]
  When error: "sudo: no tty present and no askpass program specified"
    vi /etc/sudoers
    Add line: [login name] ALL=(ALL) NOPASSWD: ALL

FreeBSD:
  Set user shell: sudo pw usermod [login name] -s /usr/sbin/nologin
  When error: "sudo: no tty present and no askpass program specified"
    vi /usr/local/etc/sudoers
    Add line: [login name] ALL=(ALL) NOPASSWD: ALL

沒有留言: