I had mounted my shared folder with this command (saved in /etc/rc.local
in order to mount the folder on system start automatically):
mount -t vboxsf -o uid=1000,gid=1000 sshkeys /root/.ssh
Now I've changed the user, the usergroup, and the access rights of the mounted folder in the mount commando:
mount -t vboxsf -o uid=0,gid=0,umask=077 sshkeys /root/.ssh
It works.
P.S. For everyone, who has participated in this discussion:
Since the thread became a bit chaotic, I would like to summarize it:
At first I had the problem, that I could not use my keys, when they came from a shared folder (Bad owner or permissions...
error). The corollary for me was, that there were two ways: (a) either to set the user, group and the access rights for the folder how the SSH client (?) needs or (b) to make it ignore its access rights restrictions. Since I could not apply chown
/chmod
to my shared folder and thought, it were not possible to change the access rights for it, I saw (b) as the last possibility to resolve the issue -- and changed the question/title. It was a mistake and I've just made this change back.
To the discussion about the security: I'm working as root (on my dev VM!) and it's a deadly sin for every safety-conscious user. Actually I also think, that normally one should not log in as root. But I hold the opinion, that it doesn't apply to the case of a dev virtual machine. Anyway -- it is an offtopic, since it has nothing to do with the issue, I've described. This issue can occur for every user of every usergroup.
5Your first problem is that
/root
shouldn't be a shared folder. You shouldn't normally be doing things as root. – Zoredache – 2013-03-07T23:34:31.833Why not? It's ("only") a virtual machine, not a real server. – automatix – 2013-03-07T23:58:05.673
6Because it is a bad habit. If you do things in a insecure manor on your local system, you will never train yourself to do things correctly on production systems. – Zoredache – 2013-03-08T00:40:52.600
3Start over and set up your virtual machine correctly, not using the root account. – Michael Hampton – 2013-03-08T02:20:38.903