P
P
Peter2016-02-15 01:09:27
virtual box
Peter, 2016-02-15 01:09:27

How to make a permanently mounted folder in Ubuntu in a virtual machine?

Host machine Win8.1
VirtualBox v5.0.14
Guest Ubuntu15.10
Folder command sudo mount -t vboxsf VirtualBoxShare /media/sharemounted without problems.
team

sudo echo VirtualBoxShare /media/share vboxsf defaults 0 0 >> /etc/fstab
I want to make it so that it is constantly watched, but ubunta gives an error bash: /etc/fstab: Permission denied
. I tried to do the same for root, but the error remains.
How to fix it and how to make sure that the shared folder in ubuntu is always mounted?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yuri Chudnovsky, 2016-02-15
@Frankenstine

For sudo echo, you can already beat your hands with a steel ruler;)
Do not use sudo and redirections (">" and ">>") in one command if you want everything to work on behalf of the same user (root). Because sudo works for the command, but not for the redirect.
Several exits:
and all commands (including redirect) will be root until you exit (exit or Ctrl+d)
launches an interpreter as root, to which the command is specified with redirection as an argument
tee runs as root and redirects to the specified file (it is intended for this), do not forget --append or -a so as not to overwrite, but append to the file.
PS line for /etc/fstab is better to take from /etc/mtab :)

N
Nazar Mokrinsky, 2016-02-15
@nazarpc

Open the file and insert the line manually.
sudo gedit /etc/fstab

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question