Steps to Create a New Sudo User
Log in to your server as the root user.
ssh root@server_ip_address
Use the adduser command to add a new user to your system.
Be sure to replace username with the user that you want to create.
adduser username
Use the passwd command to update the new user's password.
passwd username
Set and confirm the new user's password at the prompt. A strong password is highly recommended!
Set password prompts:
Changing password for user username.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
Use the usermod command to add the user to the wheel group.
usermod -aG wheel username
By default, on CentOS, members of the wheel group have sudo privileges.
Test sudo access on new user account
Use the su command 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 /root directory, which is normally only accessible to the root user.
sudo ls -la /root
The first time you use sudo in 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.
ඔන්න පුතාලා අද කියන්න හදන්නේ CentOs වල තවත් රූට් user කෙනෙක් හදාගන්න විදිහක් ගැනයි.
දැන් අපි ඔය windows වල admin user account හදන්නේ,
අන්න ඒ වගේම Linux වලත් Root User කෙනෙක්ව හදන්න යන්නේ හැබැයි පුතෝ GUI නම් නෙමේ Terminal එකෙන්,
වැඩි කතා ඕනි නෑ අපි වැඩේට බහිමුකො
ඉස්සෙල්ලම කරන්න ඕනි අපි මේ root user හදන්න ඕනි මැෂින් එකට ලොග් වෙන එක.
හැබැයි ලොග් වෙන්න ඕනි root account එකෙන්.
- ssh root@server_ip_address
දැන් adduser
කියන command එක ගහන්න ඕනි, එකෙන් තමා අලුතෙන් user කෙනෙක්ව system එකට ad කරන්නේ.
මෙන්න මේ username කියන එක තමා අලුතෙන් හදන acc එකේ නම, එක ඉතින් ඔයාට ඕනි එකක් දාගන්න.
දැන් passwd
කියන command එකෙන් අපි හදාගත්තු userගේ පාස්වඩ් එක update කරන්න හදන්නේ.
දැන් මෙහෙම එකක් එයි හරියට කරානම්
Set password prompts:
Changing password for user username.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
මෙන්න මේ usermod
කියන command එකෙන් තමා අපි හදන user මොන group එකටද add වෙන්නේ කියන එක තීරණය වෙන්නේ, ඉතින් cent වල wheel
group එකට add කරමු.
- usermod -aG wheel username
( CentOS වල එනකොටම wheel
group එකේ ඉන්න අයට sudo privileges තියනවා.
දැන් අපි හදාගත්ත acc එකට sudo access තියනවද කියල බලමු.
දැන් su
command එකෙන් switch වෙන්න හදාගත්ත account එකට
දැන් බඩු හරිද බලන්න sudo ගහල මොකක් හරි කමාන්ඩ් එකක්
උදාහරණයක්:
පලවෙනි පාරට මෙහෙම එකක් එයි
Output:
[sudo] password for username:
ඔක්කොම හරියට සෙට් උනා නම් ඉතින් ඔයා අලුත් user account එකක් හදල පාස්වඩ් දාල එක admin / root account එකක් කරන්න ඔයාට පුළුවන්
එහෙනම් මන් ගියා හැමෝටම ජයවේවා !
Manusha Amal
මගේ තියන අත්දැකීම් මේ බ්ලොග් එක කියවන ඔබට පේනවනේ, ඉතින් ඔයාලට ගැටළුවක් අවොත් මාව Contact කරගන්න පුළුවන්.
centos
Computer_Network
linux
Systems
Post A Comment: