ubuntu创建sudo 用户
The sudo command provides a mechanism for granting administrator privileges, ordinarily only available to the root user, to normal users. This guide will show you the easiest way to create a new user with sudo access on Ubuntu, without having to modify your server's sudoers file. If you want to configure sudo for an existing user, simply skip to step 3.
Steps to Create a New Sudo User
Log in to your server as the
rootuser.- ssh root@server_ip_address
Use the
addusercommand to add a new user to your system.Be sure to replace username with the user that you want to create.
- adduser username
Set and confirm the new user's password at the prompt. A strong password is highly recommended!
Set password prompts:Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Follow the prompts to set the new user's information. It is fine to accept the defaults to leave all of this information blank.
User information prompts:Changing the user information for username
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]
Use the
usermodcommand to add the user to thesudogroup.- usermod -aG sudo username
By default, on Ubuntu, members of the
sudogroup have sudo privileges.Test sudo access on new user account
Use the
sucommand to switch to the new user account.- su - username
As the new user, verify that you can use sudo by prepending "sudo" to the command that you want to run with superuser privileges.
- sudo command_to_run
For example, you can list the contents of the
/rootdirectory, which is normally only accessible to the root user.- sudo ls -la /root
The first time you use
sudoin a session, you will be prompted for the password of the user account. Enter the password to proceed.Output:[sudo] password for username:
If your user is in the proper group and you entered the password correctly, the command that you issued with sudo should run with root privileges.
ubuntu创建sudo 用户的更多相关文章
- Ubuntu创建新用户的正确姿势
作者按:因为教程所示图片使用的是 github 仓库图片,网速过慢的朋友请移步<Ubuntu 创建新用户的正确姿势>原文地址.更欢迎来我的小站看更多原创内容:godbmw.com,进行&q ...
- Ubuntu创建新用户并增加管理员权限(授权有问题)
转自:Ubuntu创建新用户并增加管理员权限 $是普通管员,#是系统管理员,在Ubuntu下,root用户默认是没有密码的,因此也就无法使用(据说是为了安全).想用root的话,得给root用户设置一 ...
- ubuntu创建新用户
ubuntu和windows一样,可以任意创建或者删除新的用户,windows下比较简单,ubuntu下需要使用命令,不过操作起来不是很繁琐,所以我尽量写的详细一些. 如何创建ubuntu新用户? ...
- Ubuntu创建新用户并设置权限
打开终端开启root账户 sudo passwd -u root 设置root密码,输入两次 sudo passwd root 切换root账号 su - 或 su root 退出root账户使用ex ...
- Ubuntu创建新用户并增加管理员权限
1.Ubuntu中的root帐号默认是被禁用了的,所以登陆的时候没有这个账号 打开终端开启root账户 sudo passwd -u root sudo passwd root 设置root密码,输入 ...
- Ubuntu 添加sudo用户
第一种方法: 添加sudo用户 当你安装Ubuntu的时候,它会自动添加第一个用户到sudo组,允许这个用户通过键入其自身帐户密 码来获得超级用户(root)身份.然而,系统不会再自动添加其他的用户到 ...
- adduser Ubuntu添加sudo用户
第一种方法: 添加sudo用户 当你安装Ubuntu的时候,它会自动添加第一个用户到sudo组,允许这个用户通过键入其自身帐户密码来获得超级用户(root)身份.然而,系统不会再自动添加其他的用户到s ...
- Ubuntu在没用root权限下如何创建sudo用户
起因 安装openCryptoki之后,如果想执行相关命令的话,那么该用户必须在pkcs11用户组中,于是执行 sudo uersmod -G pkcs11 $(whoami) 之后重启系统,执行 s ...
- (转载)ubuntu创建新用户并增加管…
问题导读: 1.adduser与useradd有什么区别? 2.那种方式会自动创建组.用户组等信息? 3.如何新建用户具有管理员权限? $是普通管员,#是系统管理员,在Ubuntu下,root用户默认 ...
随机推荐
- 微软企业库5.0 学习之路——第二步、使用VS2010+Data Access模块建立多数据库项目
现在我就开始进入学习之路的第二步——Data Access模块,这个模块是企业库中被使用频率最高的模块,它很好的封装了数据库操作应用,为我们进行多数据库系统开发提供了便利,只需更改配置文件就 可以很快 ...
- centos 磁盘分区格式化与挂载
1 查看系统里硬盘信息fdisk -l 2 磁盘分区fdisk /dev/sdc输入m显示帮助a:命令指定启动分区:d:命令删除一个存在的分区:l:命令显示分区ID号的列表:m:查看fdisk命令帮助 ...
- 快速判断&求出区间相交的长度
有两个区间A[a1,b1], B[a2,b2],判断这两个区间有没有交集.我们可以分为两种思维来判断: /** *思路就是如果两个区间不相交,那么最大的开始端一定大于最小的结束端 **/ if(max ...
- 洛谷P2783 有机化学之神偶尔会作弊
题目传送门 啦啦啦,发个文纪念一下第一道在洛谷上A的黑题,一次性就过真是无比舒服-(虽然某些大佬说这题有点水……)题目其实思路不难,Tarjan缩点+LCA,不过因为是无向边,所以在Tarjan的时候 ...
- Java集合之ArrayList与LinkList
注:示例基于JDK1.8版本 参考资料:Java知音公众号 本文超长,也是搬运的干货,希望小伙伴耐心看完. Collection集合体系 List.Set.Map是集合体系的三个接口. 其中List和 ...
- Bzoj4016/洛谷P2993 [FJOI2014] 最短路径树问题(最短路径问题+长链剖分/点分治)
题面 Bzoj 洛谷 题解 首先把最短路径树建出来(用\(Dijkstra\),没试过\(SPFA\)\(\leftarrow\)它死了),然后问题就变成了一个关于深度的问题,可以用长链剖分做,所以我 ...
- BestCoder Round #65 (ZYB's Game)
ZYB's Game Accepts: 672 Submissions: 1207 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536 ...
- BZOJ 2789 letters(树状数组)
[题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=2789 [题目大意] 给出两个字符串,通过A字符串相邻之间字符的交换得到B字符串, 求最 ...
- 【2-SAT】POJ3678-Katu Puzzle
[题目大意] 给出有向图G(V, E),每条边(a,b)有一个值c(c=0或1)和运算符op,问能否找到这一张有向图,满足所有的a op b=c? [思路] 显然是2-SAT.不过要注意一定,如a a ...
- [CodeForces-759D]Bacterial Melee
题目大意: 有一串n个字母,每个位置的字母可以同化边上的一个字母, 比如:ab可以变成aa或者bb. 相对的两个同化不能同时发生,比如ab不能变成ba. 现在给你一个字符串,问你经过任意次数的同化过程 ...