วิธีเป็น superuser in Linux

Ref –> Linux Login as Superuser (root user)

How to become superuser in Linux

Let us see some examples of the su and sudo command to become superuser in Linux.

Become a superuser in Linux using sudo command
You must be part of special secondary group on Linux:

  • sudo group on a Debian or Ubuntu Linux
  • wheel group on a CentOS/RHEL/Fedora/Oracle Linux
  •  
    You can see your secondary group membership by running either groups command or id command
    $ groups
    $ id

    Next run the following command to become a root/super user:
    $ sudo -i
    When promoted type your password to gain root shell
    and when need to logout use
    $ exit

    Mount VirtualBox shared folder

    การจะทำ Shared folder ของทางฝั่ง Host PC (Windows; the OS of the physical computer on which Oracle VM VirtualBox was installed) ให้เห็นที่ Guest OS (Debian GNU/Linux; OS ที่รันบน VirtualBox)
    ดูที่นี่ –> here

    With the VM powered off, click on Settings (on the VM) -> Shared Folders. Here, add a folder, select the path browsing in your host file system and assign it a shared_name. You can select read-only or auto-mount if you wish. After that, press ok and start the virtual machine. When it is started, try the following command:
    sudo mount -t vboxsf shared_name /mnt/
    where shared_name was the name set in “Folder Name” label and /mnt/ is the mounting point in the guest system.

    แต่ก่อนอื่นจะต้องทำการติดตั้ง VirtualBox Guest Additions ก่อน
    โดยทำดังนี้ –> here

    To install VirtualBox Guest Additions, follow these steps:

    1) Stop the virtual machine.

    2) Edit the virtual machine settings and from the “System” tab, add a new CD-ROM device to the machine.

    3) Restart the virtual machine.

    4) Check the current kernel version:
    uname -a

    5) Install some needed dependencies as shown below. Remember to replace the VERSION placeholder with the kernel version from the previous command. packages with the proper kernel_version shown by the previous command:
    sudo apt-get -y install dkms build-essential linux-headers-VERSION

    6) Restart the virtual machine:
    sudo reboot

    7) From the virtual machine menu, select the “Devices -> CD/DVD Devices -> Choose a virtual CD/DVD disk file” option. Select the VBoxGuestAdditions.iso file. This action simulates inserting a CD-ROM that includes the tools.
    The VBoxGuestAdditions.iso file is usually located in the /usr/share/virtualbox/ directory on Linux, in the C:\Program Files\Oracle\VirtualBox directory on Windows and the Contents/MacOS directory of the VirtualBox package on Mac OS X.

    8) Mount the CD-ROM and install the VirtualBox Guest Additions:
    sudo mkdir /mnt/cdrom
    sudo mount /dev/cdrom /mnt/cdrom
    cd /mnt/cdrom
    sudo sh ./VBoxLinuxAdditions.run --nox11

    You can safely ignore the error below if it appears during the installation process:
      Installing the Window System drivers ...fail!
      (Could not find the X.Org or XFree86 Window System.)

    Once the process is complete, check that the output resembles that shown below. If it does, the VirtualBox Guest Additions have been successfully installed.
      Verifying archive integrity... All good.
      Uncompressing VirtualBox 4.1.22 Guest Additions for Linux.........
      VirtualBox Guest Additions installer
      Removing existing VirtualBox DKMS kernel modules ...done.
      Removing existing VirtualBox non-DKMS kernel modules ...done.
      Building the VirtualBox Guest Additions kernel modules ...done.
      Doing non-kernel setup of the Guest Additions ...done.