Configuration files, server settings and other files in /etc/ usually owned by root user and require editing for configuration purpose on a Linux or Unix-like systems. [donotprint]
|Requirements||sudo or gksudo|
- sudo command : Execute a command as another user using command line method.
- gksudo or gksu command : Execute a command as another user using graphical tool.
The normal user needs to be a member of the admin group to raise privileges either via the sudo or gksudo/gksu command. By default, the first user account on a Ubuntu Linux is a member of the admin group. You can verify this by typing the following commands:
## find out your user name ## who am i ## verify that you are part of either sudo or admin group ## id ## Or use /etc/group file to verify that you are part of either sudo or admin group ## egrep -i 'sudo|admin' /etc/group
The nixcraft user is part of the admin or sudo group. All members of the admin group may gain root privileges or allow members of group sudo to execute any command using either CLI or graphical method.
Command line method
The syntax is:
sudo command sudo command arg1 arg2
Open the Terminal app and edit file called /etc/resolv.conf either using with nano or vi text editor:
sudo nano /etc/resolv.conf
sudo vi /etc/resolv.conf
You need to provide normal user’s password when prompted:
The syntax is as follows to edit the file /etc/resolv.conf using the gksudo command. First, press ALT-F2 and type the following command in the box (open the terminal app and type the following command):
gksudo gedit /etc/resolv.conf
Finally, gedit will open as follows:
- Linux Run Command As Another User – explains use of su and runuser commands on a Linux bases systems.
- Man pages – gksu(1)
|Category||List of Unix and Linux commands|
|Firewall||CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04|
|Network Utilities||dig • host • ip • nmap|
|OpenVPN||CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04|
|Package Manager||apk • apt|
|Processes Management||bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time|
|Searching||grep • whereis • which|
|User Information||groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w|
|WireGuard VPN||CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04|