您的位置:首页 > 其它

Ubuntu添加用户并赋予sudo权限

2013-11-07 16:58 666 查看


Create a User

To create a user in Ubuntu, open terminal (Ctrl+Alt+t) and execute the command (replace user_name with the username of your choice etc coolgeek).
sudo adduser user_name


(Then you will be prompted to Enter the details for the new user such as password, Name, Room Number, Phone Number etc, just enter the details correctly and hit ‘y’)


Granting sudo power to the User

Now, you’ve created the user, you can add the user to sudo group (which is created by default in Ubuntu, you could also use admin group) using the following command -
sudo adduser user_name sudo


OR
sudo adduser user_name admin




In the case if sudo group doesn’t exist or you want to create your own group then use the following commands -


Creating a Group (User Group)

First create a group using the command (Replace group_name with the group you want to create e.g geeky)-
sudo addgroup group_name


Then add that group to sudoers file, to do that first open the file using the command -
sudo visudo


and add the following line to the bottom of the file (then save the file and exit).
%group_name  ALL=(ALL:ALL) ALL


Although creating groups isn’t necessary but it makes user management (with different privileges) much easier. Anyway, if you just want to grant root permission to any user then add this line to the sudoers file -
user_name  ALL=(ALL:ALL) ALL
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: