(转)How To Create a Sudo User on Ubuntu
转自:https://linuxize.com/post/how-to-create-a-sudo-user-on-ubuntu/
The sudo command is designed to allow users to run programs with the security privileges of another user, by default the root user.
In this guide, we will show you how to create a new user on an Ubuntu machine and give it sudo access. You can then use this user account to execute administrative commands without a need to logging in to your Ubuntu server as a root user.
Steps to create a sudo user
Follow the steps below to create a new user account and give it sudo access. If you want to configure sudo for an existing user, skip to step 3.
1. Log in to your server.
Log in to your system as the root user:
ssh root@server_ip_address
Copy
2. Create a new user account.
Create a new user account using the adduser command. Don’t forget to replace usernamewith the user name that you want to create:
adduser username
Copy
You will be prompted to set and confirm the new user password. Make sure that the password for the new account is as strong as possible.
Adding user `username' ...
Adding new group `username' (1001) ...
Adding new user `username' (1001) with group `username' ...
Creating home directory `/home/username' ...
Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Copy
Once you set the password the command will create a home directory for the user, copy several configuration files in the home directory and prompts you to set the new user’s information. If you want to leave all of this information blank just press ENTER to accept the defaults.
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]
Copy
3. Add the new user to the sudo group
By default on Ubuntu systems, members of the group sudo are granted with sudo access. To add the user you created to the sudo group use the usermod command:
usermod -aG sudo username
Copy
Test the sudo access
Switch to the newly created user:
su - username
Copy
Use the sudo command to run the whoami command:
sudo whoami
Copy
Is the user have sudo access then the output of the whoami command will be root:
root
Copy
How to use sudo
To use sudo, simply prefix the command with sudo and space:
sudo ls -l /root
Copy
The first time you use sudo in a session, you will be prompted to enter the user password:
[sudo] password for username:
Copy
Conclusion
You have learned how to create a user with sudo privileges. You can now log in to your Ubuntu server with this user account and use sudo to run administrative commands.
That’s all! Feel free to leave a comment if you have any questions.
(转)How To Create a Sudo User on Ubuntu的更多相关文章
- How to create a PPPoE Server on Ubuntu? (Untested)
How to create a PPPoE Server on Ubuntu? March 30, 2011 coder_commenter Leave a comment Go to comment ...
- Create & use FTP service on Ubuntu(在Ubuntu上搭建并使用FTP服务)
Check if the FTP service has been installed.(检查是否已安装) Vsftpd --version If it has not install,Pres ...
- linux学习: sudo命令(ubuntu)
使用 sudo 命令可以提高命令的执行权限,以root权限执行 如 : sudo vi xxx 但是有些内置命令 如 cd 无法通过 sudo来执行 ,如 sudo cd xxx 这是会报错的. ...
- Linux服务器新建用户和组,并分配sudo权限 (Ubuntu系统)
新拿到一台服务器后我们一般都是要新建用户组,用户,并为其分配权限. ==================================================== 赋予用户组sudo权限: ...
- ubuntu创建sudo 用户
The sudo command provides a mechanism for granting administrator privileges, ordinarily only availab ...
- 【linux】linux创建用户并授予sudo权限
1. 新建用户 root@ubuntu:~# adduser hadoop root@ubuntu:~# passwd hadoop #为hadoop用户设置密码 2. 为hadoop用户添加sudo ...
- unbuntu下的root 用户和 sudo 命令
参考: http://james23dier.iteye.com/blog/721246 http://blog.csdn.net/shichexixi/article/details/5969993 ...
- 【新技术】Docker 学习笔记
原文地址 一.Docker 简介 Docker 两个主要部件: Docker: 开源的容器虚拟化平台 Docker Hub: 用于分享.管理 Docker 容器的 Docker SaaS 平台 -- ...
- 导出本地和远程SVN项目, Export remote SVN repository
在有服务器控制权的情况下, 源服务器上 sudo svnadmin dump ironbank/ > ~/ironbank.svn.dump 在目的服务器上 sudo svnadmin crea ...
随机推荐
- pt-online-schema-change 最佳实践(转)
pt的详细步骤 Step 1: Create the new table. Step 2: Alter the new, empty table. This should be very quick, ...
- springboot-注解-@Repository、@Service、@Controller 和 @Component
Spring 2.5 中除了提供 @Component 注释外,还定义了几个拥有特殊语义的注释,它们分别是:@Repository.@Service 和 @Controller.在目前的 Spring ...
- 后端将Long类型数据传输到前端出现精度丢失的问题
当将超过16位的数字传输到前端的时候,就会出现精度丢失的问题,然后我按照网上的几种方法实验的时候,只有一种方法成功了.可能是因为环境等方面的问题. 我这里成功是因为:最后使用的是配置mvc的方式,然后 ...
- postman:设置环境变量(参数化 & 关联)
postman是测试接口的主要工具之一 我们的测试环境主要分为test(测试环境)和pre_production(预生产环境),而他们的api都是一样的,只是ip及端口不一样 所以,我们可以设置环境变 ...
- iframe跨域修改子页面内容或样式
哈哈 当然不能啦 要是能修改百度logo早就是我的头像了
- 滚动加载|页面滑到底部加载数据|jquery.endless-scroll插件|使用demo
<html> <head> <link rel="dns-prefetch" href="http://i.tq121.com.cn&quo ...
- linux 下安装git的步骤方法
①.获取github最新的Git安装包下载链接,进入Linux服务器,执行下载,命令为: wget https://github.com/git/git/archive/v2.17.0.tar.gz ...
- 一些开源的dashboard 解决方案
简单收集了以下开源dashboard 的项目,记录下 plotly-dash 基于python 的dash 开发工具,很不错 项目地址 https://github.com/plotly/dash k ...
- 使用docker部署微服务
https://my.oschina.net/silenceyawen/blog/1819472 http://jvm123.com/2019/08/docker-shi-yong.html 从201 ...
- [PHP]Laravel无法使用COOKIE和SESSION的解决方法
COOKIE和SESSION的具体使用百度和官方文档上都有. 但是,文档里没有说明必须经过相应的中间件才能使用,百度搜索结果都是彼此copy的bullshit!!! 其实最终解决办法很简单,完全不是网 ...