How To Give Su Rigth To User In FreeBSD?


I have a FreeBSD box. I want to connect this system remotely with ssh. FreeBSD security settings are very restricted so we can not connect the FreeBSD system with root user remotely. We will ssh with a regular existing user and then login as root with su command. The problem is the regular existing user can not run su command. How can we give the ability to run su command to a regular user in FreeBSD?

su Error

When we try to run su command we will get following errors.

$ su 
su: Sorry 
$ su root 
su: Sorry 
$ sudo root 
-sh: sudo: not found 
$ sudo su 
-sh: sudo: not found

Add User To Wheel Group

We need to add the current user to the wheel group. Open /etc/group file with an editor you are comfortable. Here I used vi because I have no chose. And add user name after the root user name like below.

wheel:*:0:root,ismail

Escalate Privilege

Now we can easily su with our user ismail

$ su 
Password: 
[email protected]:/usr/home/ismail # cat /etc/group  
# $FreeBSD: releng/11.0/etc/group 294896 2016-01-27 06:28:56Z araujo $ 
#
Escalate Privilege
Escalate Privilege

LEARN MORE  How To Disable or Enable SELinux Temporarily or Permanently?

Leave a Comment