Wednesday, September 3, 2014

FreeBSD : How to enable su access or switch to superuser in freebsd

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
freebsd su access

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)
Step 2: Now edit the /etc/pam.d/su file
Locate the line in /etc/pam.d/su file
Now add sugroup after wheel by giving comma(,). see the below reference
Step 3: I have a user called sharad,now we will add sharad user to additional group called 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
freebsd-sudo5

No comments: