creating symbolic link: Protocol error

后端 未结 7 1025
一整个雨季
一整个雨季 2021-02-01 02:51

I have created linux (Centos) on my virtual box. When I ssh to it and I try to create symbolic link (on my shared folder with full access):

ln -s path/folder/exa         


        
相关标签:
7条回答
  • 2021-02-01 03:08

    find the cmd.exe file. Right click on the cmd.exe . Select "Run as Administrator" menu option. It should work perfectly.

    0 讨论(0)
  • 2021-02-01 03:08

    Basically you need to again tell VirtualBox to enable symlinks. Here's the complete solution

    Have this in your vagrant file,

    config.vm.provider "virtualbox" do |v|
        v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/Folder_Name", "1"]
    end
    

    I recommended comment out any sync folder and let default ./(at host) synced at /vagrant(at guest). This will make sure your shared folder(Folder_Name) name is always vagrant as mentioned here https://www.vagrantup.com/docs/synced-folders/. Also, you won't face issues with ssh

    If the symlink protocol error returns after restart or still persists run

    VBoxManage setextradata "VM_Name" VBoxInternal2/SharedFoldersEnableSymlinksCreate/Folder_Name 1
    
    vagrant halt
    vagrant up
    
    vagrant ssh
    

    Usually, VBoxManagee is located at C:\Program Files\Oracle\VirtualBox\

    Verify working of symlink by going to /vagrant and running

    touch test.txt && ln -s test.txt test1.txt
    

    PS: I have tried this on Windows Home which has limited accessibility to security settings

    0 讨论(0)
  • 2021-02-01 03:16

    Right click on your command prompt and "Run as Administrator" (or whatever program you're using to make those symlinks needs to be run as adminstrator).

    0 讨论(0)
  • 2021-02-01 03:19

    It's a problem with the host filesystem. Check the permissions on the host folder are adequate and the the host filesystem supports symlinks.

    0 讨论(0)
  • 2021-02-01 03:21

    As I understand, Windows VirtualBox hosts doesn't support links (from https://www.virtualbox.org/manual/ch04.html#sharedfolders)

    Starting with version 4.0, VirtualBox shared folders also support symbolic links (symlinks), under the following conditions:

    The host operating system must support symlinks (i.e. a Mac, Linux or Solaris host is required).

    Currently only Linux and Solaris Guest Additions support symlinks.

    For security reasons the guest OS is not allowed to create symlinks by default. If you trust the guest OS to not abuse the functionality, you can enable creation of symlinks for "sharename" with:

    VBoxManage setextradata "VM name" VBoxInternal2/SharedFoldersEnableSymlinksCreate/sharename 1

    0 讨论(0)
  • 2021-02-01 03:23

    Here is the solution in a ticket on virtualbox.org : https://www.virtualbox.org/ticket/10085#comment:32 (Note: Execute "whoami /priv" in console with Administrative privileges)

    I have done some Windows research on this bug.

    If your user is of the Administrator type (rather than a Standard account), there's no way to run VB with symlinks working without the UAC prompt.

    If you have a Standard user account (or if you are willing to switch your account to Standard and create a separate Admin account), the solution exists. You will, however, need admin privileges to accomplish several of the steps (not necesarrily for your user account).

    1. Run the Local Security Policy (Win+R, type "secpol.msc", confirm UAC). Then navigate to "Local Policies->User Rights Assignment".
    2. Find the permission called "Create symbolic links" and double-click it. Add your user to the list of objects having this permission. Or you can add the "Users" group. Log off and log on. You can check the success by running in console:

      whoami /priv
      

      If you see the privilege SeCreateSymbolicLinkPrivilege enabled, you've done well.

    3. Make sure your user has proper access to the shared folder on host system.

    4. As mentioned here earlier, execute

      VBoxManage setextradata VM_NAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME 1
      

      in a console from the C:\Program Files\VirtualBox folder. Don't forget to substitute VM_NAME with the name of your VM and SHARE_NAME with the name of the shared folder (as it appears in the VM settings).

    5. You're done.

    If you happen to own one of the "lesser" version of windows (e.g. 7 Home), you don't have the "secpol.msc" utility. See How do I grant SeCreateSymbolicLink on Windows Vista Home edition for help.

    0 讨论(0)
提交回复
热议问题