How To Execute A Command With Superuser Privilege In FreeBSD?
This post was last updated on August 1st, 2020 at 10:28 am
A superuser or root user is a most privileged user account in FreeBSD. It has access to all the commands and files of the system. A root user or superuser is also called the administrator because it is needed to perform all the administrative tasks.
With superuser privileges, you can perform tasks such as installing software, changing the ownership and permissions of files, and managing other user accounts which can not be done with a normal user account.
In this article, we will discuss how a normal user can execute a command with superuser privileges in FreeBSD.
How to become superuser in FreeBSD
In FreeBSD, there are various ways to gain superuser privilege. You can log in with the root account, this is not recommended for day to day tasks such as sending and receiving emails, programming, etc. Misuse of root account can damage the system as it operates without limits.
Instead, use the su command with a – (dash) to inherit the root user’s environment. Also, it is advised to double-check any command before you execute it as a superuser.
Using root account in FreeBSD
In FreeBSD, a standard root account is created while the installation of the operating system. You can log in as root by entering root as the login and password and then you can start using it. Generally, it is used to perform administrative tasks.
Using su to become superuser in FreeBSD
To become the superuser using su command you should run the following command in your terminal –
The user who is running this command must be in the wheel group otherwise the command will fail. You can use the given command to add a user in the wheel group –
pw groupmod wheel -m lalit
And also the user must know the password of the root user account.
Use any of the given methods to become the superuser and then execute any command that requires extra privileges.
There are other ways such as using sudo which can also be used to execute a command with superuser privilege. Now if you have any thoughts on this topic, you can share with us in the comments below.
You might also like
This post was last updated on August 1st, 2020 at 12:17 pmDifferent Linux distribution comes with different tools to manage software packages on it. Pacman-based Linux distributions such as Arch
This post was last updated on May 26th, 2020 at 03:05 pm Contents1 Starting a Job in the Background [cmd &]2 Stopping (Pausing) a Job [CTRL+z]3 Listing Jobs [jobs]4 Resuming
This post was last updated on May 27th, 2020 at 05:10 pm Tentative notes for converting / from ext2 to ext3 while booted on /: unmount everything (including /proc …)