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?
我有一个FreeBSD盒子。 我想将此系统与ssh远程连接。 FreeBSD的安全性设置非常严格,因此我们无法将FreeBSD系统与root用户远程连接。 我们将使用常规的现有用户ssh,然后使用su命令以root用户身份登录。 问题是普通现有用户无法运行su命令。 我们如何赋予FreeBSD中的普通用户运行su命令的能力?
su错误 (su Error)
When we try to run su
command we will get following errors.
当我们尝试运行su
命令时,将出现以下错误。
$ 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组。 使用舒适的编辑器打开/ etc / group文件。 在这里我使用vi是因为我没有选择。 并在根用户名之后添加用户名,如下所示。
wheel:*:0:root,ismail
升级特权 (Escalate Privilege)
Now we can easily su with our user ismail
现在,我们可以轻松地与我们的用户ismail su
$ su
Password:
[email protected]:/usr/home/ismail # cat /etc/group
# $FreeBSD: releng/11.0/etc/group 294896 2016-01-27 06:28:56Z araujo $
#
