How to enable su access or switch to superuser
In this tutorial we will learn how to enable su access or switch to superuser in FreeBSD.
su
command is used to become another user during a login session. To become a superuser you can use the command su -
or su -l root
.But after installing freebsd the user other than root is not able to switch to another user by using su command.In below given screenshot we can see the error:
ERROR-> su: Sorry
To enable su access ,follow the given below steps
Step 1: Login as a root in a system and create a new group called sugroup (You can give any other name to new group also)
1
|
pw groupadd sugroup
|
Step 2: Now edit the /etc/pam.d/su file
1
|
vi /etc/pam.d/su
|
Locate the line in /etc/pam.d/su file
1
|
auth requisite pam_group.so no_warn group=wheel root_only fail_safe ruser
|
Now add sugroup after wheel by giving comma(,). see the below reference
1
|
auth requisite pam_group.so no_warn group=wheel,sugroup root_only fail_safe ruser
|
Step 3: I have a user called sharad,now we will add sharad user to additional group called sugroup
1
|
pw user mod sharad -G sugroup
|
Note: Replace sharad user with your user name.
To enable su access to other user or new user ,you have to only add these users into additional group called sugroup by using above given command in Step 3(as per tutorial)
Step 4: Now exit from system and login as user and try using
su
command to switch to another user or become superuser
Below is screenshot of enabled su access for superuser
No comments:
Post a Comment