granting privileges<\/a> to normal users with root privileges.<\/p>\n\n\n\nusermod -aG sudo developer<\/pre>\n\n\n\nOnce the developer user is added to the sudo group, we will test with real examples. First, switch to the developer user with the command below:<\/p>\n\n\n\n
su - developer\n<\/pre>\n\n\n\nThe command prompt should look like this:<\/p>\n\n\n\n
root@host:~# su - developer\nTo run a command as administrator (user \"root\"), use \"sudo \".\nSee \"man sudo_root\" for details.\n\ndeveloper@host:~$\n<\/command><\/pre>\n\n\n\nNow, we can test the sudo user with the following commands:<\/p>\n\n\n\n
sudo ls -alh \/root<\/pre>\n\n\n\nYou will need to enter the password for the developer<\/b> user<\/p>\n\n\n\ndeveloper@host:~$ sudo ls -alh \/root\/\n[sudo] password for developer:<\/pre>\n\n\n\nOnce the password is entered, you will see the content of the \/root directory.<\/p>\n\n\n\n
root@host:~# su - developer\ndeveloper@host:~$ sudo ls -alh \/root\/\n[sudo] password for developer:\ntotal 40K\ndrwx------ 4 root root 4.0K Feb 10 16:36 .\ndrwxr-xr-x 19 root root 4.0K Feb 10 16:35 ..\n-rw------- 1 root root 412 Feb 15 06:10 .bash_history\n-rw-r--r-- 1 root root 57 Feb 10 16:35 .bash_profile\n-rw-r--r-- 1 root root 3.1K Dec 5 2019 .bashrc\ndrwx------ 2 root root 4.0K May 11 2020 .cache\n-rw-r--r-- 1 root root 161 Dec 5 2019 .profile\ndrwx------ 2 root root 4.0K Feb 10 16:35 .ssh\n-rw------- 1 root root 3.4K Jul 30 2022 .viminfo\n-rw-r--r-- 1 root root 174 Feb 10 16:35 .wget-hsts<\/pre>\n\n\n\nNow, you will be able to modify any file on the system since the user developer is added to the sudo group. Let’s execute the following command:<\/p>\n\n\n\n
sudo cat \/etc\/sudoers<\/pre>\n\n\n\nYou will be able to see the content of the sudoers file:<\/p>\n\n\n\n
#\n# This file MUST be edited with the 'visudo' command as root.\n#\n# Please consider adding local content in \/etc\/sudoers.d\/ instead of\n# directly modifying this file.\n#\n# See the man page for details on how to write a sudoers file.\n#\nDefaults env_reset\nDefaults mail_badpass\nDefaults secure_path=\"\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin:\/snap\/bin\"\nDefaults use_pty\n\n# This preserves proxy settings from user environments of root\n# equivalent users (group sudo)\n#Defaults:%sudo env_keep += \"http_proxy https_proxy ftp_proxy all_proxy no_proxy\"\n\n# This allows running arbitrary commands, but so does ALL, and it means\n# different sudoers have their choice of editor respected.\n#Defaults:%sudo env_keep += \"EDITOR\"\n\n# Completely harmless preservation of a user preference.\n#Defaults:%sudo env_keep += \"GREP_COLOR\"\n\n# While you shouldn't normally run git as root, you need to with etckeeper\n#Defaults:%sudo env_keep += \"GIT_AUTHOR_* GIT_COMMITTER_*\"\n\n\t\t\t\t\t\t\t.\n\t\t\t\t\t\t\t.\n\t\t\t\t\t\t\t.\n\t\t\t\t\t\t\t.\n\t\t\t\t\t\t\t.\n\t\t\t\t\t\t\t.\n\t\t\t\t\t\t\t.\n\t\t\t\t\t\t\t.\n\t\t\t\t\t\t\t.\n\t\t\t\t\t\t\t.\n\n\n<\/pre>\n\n\n\nThis time the password was not required since we already entered it once, and this is proof that this developer<\/b> user has root privileges.<\/p>\n\n\n\n
That’s it. You successfully created a sudo user on Ubuntu 22.04 with permissions. If you find this difficult, you can always contact our technical support, and they will help you with any aspect of this. All you need to do is to sign up for one of our NVMe VPS hosting<\/a> plans and submit a support ticket. We are available 24\/7.<\/p>\n\n\n\nIf you liked this post about creating a sudo user on Ubuntu 22.04, please share it with your friends on social networks or simply leave a reply below.<\/p>\n","protected":false},"excerpt":{"rendered":"
In this blog post, we will explain to you how to create a sudo user on Ubuntu 22.04 OS. Sudo … <\/p>\n
Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":45004,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1236,21,13],"tags":[2049,1548,1642],"yoast_head":"\nHow to Create a Sudo User on Ubuntu 22.04 - RoseHosting<\/title>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n \n \n \n \n \n \n \n\t \n\t \n\t \n