Solutions for switching from FreeBSD to root su: Sorry

Time:2019-6-16

Under FreeBSD, connect to FreeBSD through SSH client, log in with ordinary user, and execute the following commands to report errors:

$ su root
su: Sorry
$ su
su: Sorry
$

In order to use Su command to become root user on FreeBSD, you need to know the password of root, but also need special settings. Otherwise, you can’t use this command successfully. This is because FreeBSD imposes stricter restrictions on users who can execute Su commands. Users who can use Su commands must belong to the wheel group (the basic group of root, group ID is 0), otherwise they cannot become root users through this command. Therefore, the edit group setting file / etc / group is needed, and the administrator of superuser rights will be added to the wheel group.

Log in with root user from the terminal, modify the / etc / group file, add ordinary users in the wheel group, add the following:

freebsd# cat /etc/group
# $FreeBSD: src/etc/group,v 1.32.2.1 2006/03/06 22:23:10 rwatson Exp $
#
wheel:*:0:root,hxh
daemon:*:1:
kmem:*:2:

Then use hxh user SSH login, switch to root user successfully.