Sử dụng tài khoản Root trong ubuntu

 

Root là gì? Làm sao để trở thành root trong Linux? - QuanTriMang.com




xerus@dlp:~$
sudo -s

[sudo] password for xerus:
# own password

root@dlp:~#
# switched

[2] Or it's possible to switch to root account with su command to set root account's password.
xerus@dlp:~$
sudo passwd root

[sudo] password for xerus:
# own password

Enter new UNIX password:
# set root password

Retype new UNIX password:
# confirm

passwd: password updated successfully
xerus@dlp:~$
su -

Password:
# input root password

root@dlp:~#
# switched

*
The examples on this site shows as a root account. If you use Sudo, add "sudo" on the head of commands.
It had better to limit user if you enable root account.
For using by Sudo, it's possible to limit to prohibit shells in sudoers config, refer to details about Sudo Settings.
[3] For limit to do su command, set like follows.
root@dlp:~#vi /etc/pam.d/su
# line 15: uncomment and add a group which is allow to do su command

auth   required   pam_wheel.so  group=adm
root@dlp:~# usermod -G adm ubuntu

Nhận xét