Log in to UBUNTU and VMware mount shared directories as root

root login 14.04

  • Set root's passwd
    # 设置密码
    sudo passwd root
    # 切换到root帐号
    su root
    
  • Configure login (allow root login)
    cd /usr/share/lightdm/lightdm.conf.d
    cp 50-unity-greeter.conf 50-unity-greeter.conf.backup
    vim 50-unity-greeter.conf
    cat 50-unity-greeter.conf
    [SeatDefaults]
    greeter-session=unity-greeter
    user-session=ubuntu
    greeter-show-manual-login=true
    all-guest=false
    
    Then, edit root's profile
    vim /root/.profile
    将 /root/.profile 文件中的 mesg n 替换成 tty -s && mesg n
    

root login 18.04

Reference: https://www.cnblogs.com/masbay/p/10744900.html

  • Set root's passwd
    sudo passwd root
    su root
    
  • Configure lightdm
    cd  /usr/share/lightdm/lightdm.conf.d
    cp  50-unity-greeter.conf 50-unity-greeter.conf.backup
    vim 50-unity-greeter.conf
    
    Open the file, add the following two lines at the end of the file, save and close after completion (note this step, do not delete the original two lines in the file );
    greeter-show-manual-login=true
    all-guest=false
    
  • Enter the /etc/pam.d folder and modify the contents of the gdm-autologin and gdm-password files (refer to the command in step 2):
    gdm-autologin,    注释掉 auth required pam_success_if.so user!=root quiet_success 这一行
    gdm-gdm-password, 注释掉 auth required pam_success_if.so user!=root quiet_success 这一行
    
  • Modify the /root/.profile file
    # sudo gedit /root/.profile
    tty -s && mesg n || true
    
  • carry out

Cannot see shared directories in VMware

Reference: https://blog.csdn.net/donglynn/article/details/55046017

  • 1) Confirm that VMtools has been installed, open the shared folder, and set the shared directory

  • 2) View the set shared directory

    root@ubuntu:~# vmware-hgfsclient
    temp
    work
    
  • 3) Manually mount

    sudo mount -t vmhgfs .host:/temp /mnt/hgfs/temp
    Error: cannot mount filesystem: No such device
    

    If the above error occurs, you can use the following command to manually mount

    vmhgfs-fuse .host:/temp /mnt/hgfs/temp
    
  • 4) Script written by the above command, execute script mount

    # 首先确认你安装了vmware,并且安装了kernel相关(以下是 CentOS 或 RedHat 发行版的安装命令)。
    yum install kernel kernel-headers kernel-devel -y
    

    The following is the content of the script

    #!/bin/bash
    vmware-hgfsclient | while read folder; do
      echo "[i] Mounting ${folder}   (/mnt/hgfs/${folder})"
      if [ ! -d /mnt/hgfs/${folder} ]; then
        mkdir -p /mnt/hgfs/${folder}
      fi
      umount -f /mnt/hgfs/${folder} 2>/dev/null
      vmhgfs-fuse  -o allow_other  -o auto_unmount  .host:/${folder}  /mnt/hgfs/${folder}
    done
    sleep 2s
    

Guess you like

Origin blog.csdn.net/hylaking/article/details/100101148