Add a new user account with admin access on Linux

栏目: IT技术 · 发布时间: 4年前

内容简介:files.Commands to add or create a sudo user (admin) on an Ubuntu or Debian Linux server:

H ow do I add a user account with admin (sudo) access on Ubuntu or CentOS Linux cloud server? How can I add a new user with admin account level access in Linux?

On the Linux operating system, one needs to use the sudo command to provide admin-level access. In other words, the sudo command grants admin privileges to ordinary users. This page shows how to create a new user with admin (sudo) access on both Ubuntu/Debian and CentOS/RHEL servers. Please note that the following commands will update/etc/passwd,/etc/group, and /etc/shadow

files.

Create a new user account with admin (sudo) access on Ubuntu or Debian Linux

Commands to add or create a sudo user (admin) on an Ubuntu or Debian Linux server:

  • Open the terminal application
  • For remote Ubuntu/Debian server use the ssh command and log in as the root user using either su or sudo.
  • Create a new user named marlena , run: adduser marlena
  • Make marlena user ‘sudo user’ (admin) run: usermod -aG sudo marlena
  • Verify it by running the id marlena command
  • Log in as marlena: su - marlena . Than run sudo command for verification. For example: sudo ls -l /etc/shadow

Add a new user account with admin access on Linux

A note about granting sudo account for an existing Ubuntu/Debian Linux user

The syntax is:

usermod -aG wheel UserNameHere

Log in as the root user and add an existing user accout named ‘sai’ to sudo group:

usermod -aG wheel sai
id sai

See “ How to create a new sudo user on Ubuntu Linux server ” for more info.

RHEL or CentOS create a new user account with admin (sudo) access

Procedure to add or create a sudo user (admin) on CentOS or RHEL:

  • Open the terminal application
  • For remote CentOS server use the ssh command and log in as the root user using either su or sudo.
  • Create a new CentOS user named vivek , run: useradd vivek
  • Set the password, execute: passwd vivek
  • Make vivek user ‘sudo user’ on CentOS/RHEL, run : usermod -aG wheel vivek
  • Verify it by running the id vivek command

Add a new user account with admin access on Linux

How to grant sudo access for an existing RHEL/CentOS Linux user

The syntax is as follows for the usermod command andid command:

# usermod -aG wheel User-Name-Here

Add an existing user account named kirsh to wheel group. In other words, type the following two commands:

# usermod -aG wheel krish
# id krish

See Add / Create a Sudo User on CentOS Linux 8 for more info.

Conclusion

You learned how to create a sudo (admin level access) user account on both Ubuntu/Debian and RHEL/CentOS Linux servers.


以上所述就是小编给大家介绍的《Add a new user account with admin access on Linux》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

应用Rails进行敏捷Web开发

应用Rails进行敏捷Web开发

Dave Thomas, David Hansson等 / 林芷薰 / 电子工业出版社 / 2006-7 / 65.00元

这是第一本关于Ruby on Rails的著作。 全书主要内容分为两大部分。在“构建应用程序”部分中,读者将看到一个完整的“在线购书网站” 示例。在演示的过程中,作者真实地再现了一个完整的迭代式开发过程,让读者亲身体验实际应用开发中遇到的各种问题、以及Rails如何有效解决这些问题。在随后的“Rails框架”部分中,作者深入介绍了Rails框架的各个组成部分。尤为值得一提的是本部分的后几章......一起来看看 《应用Rails进行敏捷Web开发》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具