2010年2月24日 星期三

新增sudo user

Linux:
  1. sudo su -
  2. cd /usr/sbin

  3. ./adduser 新增的帳號  EX:./adduser testacc
  4. 給新增的帳號密碼 passwd 帳號 EX:passwd testacc
  5. 開啟visudo ./visudo 
  6. 按下i進入編輯
  7. 在 ## Allow root to run any commands anywhere
    root    ALL=(ALL)       ALL
    後加入  testacc    ALL=(ALL)       ALL
  8. 按下:wq!存檔
FreeBsd:





1.打adduser
# adduser
Username: testname
Full name: testname
Uid (Leave empty for default): 
Login group [testname]: 
Login group is testname. Invite testname into other groups? []: 
Login class [default]: 
Shell (sh csh tcsh nologin) [sh]: 
Home directory [/home/testname]: 
Home directory permissions (Leave empty for default): 
Use password-based authentication? [yes]: yes
Use an empty password? (yes/no) [no]: no
Use a random password? (yes/no) [no]: no
Enter password: 
Enter password again: 
Lock out the account after creation? [no]: 
Username   : testname
Password   : *****
Full Name  : testname
Uid        : 1008
Class      : 
Groups     : testname 
Home       : /home/testname
Home Mode  : 
Shell      : /bin/sh
Locked     : no
OK? (yes/no): yes
adduser: INFO: Successfully added (testname) to the user database.
Add another user? (yes/no): no
Goodbye!

2.編輯sudoers
vi /usr/local/etc/sudoers

在# User privilege specification
root    ALL=(ALL) ALL
後加入
testname ALL=(ALL) ALL



freebsd 安裝sudo
ssh> cd /usr/ports/security/sudo
ssh> make install clean
進入後有個畫面,直接按TAB,然後OK
ssh> rehash

沒有留言: