I don't understand how this solution worked for everybody who wanted to mount a volume as a read-only directory using sshfs. Everyone suggest using the 'ro' option. I did that, but the files in the mounted volume are still writeable. Why it doesn't work for me?
sshfs -p 2221 -o ro,idmap=user,reconnect,dev,IdentityFile=/home/user/.ssh/volume_key,Ciphers=arcfour myuser@XXXXXX://base-dir/ mountpoint/
The permission of the folder on the remote volume is 777, the permissions of the local folder are 755, the user on my local machine and the remote machine are the same and the user:group on the local folder is myuser:myuser, after mounting it becomes 1027:users. So mounting the folder changes both the permissions and the owners of the folder, no matter if I use 'ro' or not.
ssh-copy-id
. I made my/cifs_mount
folder have 777 on it as I use that folder for testing. Then when I connected to my server this was all I didsshfs -o ro [email protected]:/media/storage /cifs_mount/
. Then tested it by$ touch /cifs_mount/testfile.txt touch: cannot touch '/cifs_mount/testfile.txt': Read-only file system
mount
command by itself, it will show you all the mounts on your system and how they are running. At the end of each line it will show something like:(rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
and the particular line of the mount for the sshfs with the ro looks like(ro,nosuid,nodev,relatime,user_id=1000,group_id=1000)
. It is always at the beginning of that part if it is in Read Write (rw) or Read Only (ro).