某些服务器运营商给的默认账户是root,如果在平日里使用root风险太大,个人习惯使用一个普通带sudo的账户,既有了普通账户的安全,又有了sudo的高级权限。记录一下过程:
1. 用root登录到服务器:
ssh
2. 添加用户:
adduser yourusername
3. 会提示一些进度信息,比如说创建home文件夹,创建新组等,如下:
Adding user 'yourusername' ... Adding new group `yourusername' (1000) ... Adding new user `yourusername' (1000) with group 'yourusername' ... Creating home directory `/home/yourusername' ... Copying files from `/etc/skel' ... Enter new UNIX password: Retype new UNIX password:
4. 收入密码后,会让你填写一些用户信息,可以留空:
passwd: password updated successfully Changing the user information for shuspieler Enter the new value, or press ENTER for the default Full Name []: Room Number []: Work Phone []: Home Phone []: Other []: Is the information correct? [Y/n] y
4. 加入sudo组:
adduser yourusername sudo
5.会有提示信息如下:
Adding user 'yourusername' to group `sudo' ... Adding user yourusername to group sudo Done.
6. 可以用新用户登录了。