Setting up SFTP on Ubuntu Server, remoting in via VirtualBox Ubuntu Desktop. Need to fix folder permissions for access
I have a physical box running Ubuntu Server and a VirutalBox virtual machine running Ubuntu Desktop. All I’m trying to do is set up access to my /media folder on the physical Ubuntu Server which contains my external hard drives so I can copy files from my Windows machine through the Ubuntu Desktop VM to my Ubuntu Server box.
This is the guide I followed: www.websentra.com/setup-sftp-server-on-ubuntu/ (I did not do the part 5. Authenticating via public keys)
I did create an admin login for the purposes of FTP instead of leaving it anonymous.
I decided to play around and test changing the ChrootDirectory to /media/, you can see my 4tbstorage and 8tbstorage drives:
# override default of no subsystems
Subsystem sftp /usr/lib/openssh/sftp-server
Match group ftpaccess
ChrootDirectory /media/
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
and
tom@ubuntu-server:/etc/ssh$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 476.9G 0 disk
├─sda1 8:1 0 1G 0 part /boot/efi
├─sda2 8:2 0 2G 0 part /boot
└─sda3 8:3 0 473.9G 0 part
└─ubuntu--vg-ubuntu--lv 252:0 0 100G 0 lvm /
sdb 8:16 0 3.6T 0 disk
├─sdb1 8:17 0 9.8G 0 part
└─sdb2 8:18 0 3.6T 0 part /media/4tbstorage
sdc 8:32 0 7.3T 0 disk
├─sdc1 8:33 0 9.8G 0 part
└─sdc2 8:34 0 7.3T 0 part /media/8tbstorage
Folder permissions:
tom@ubuntu-server:/etc/ssh$ ls -l /media
total 8
drwxr-xr-x 6 tom tom 4096 Oct 14 23:41 4tbstorage
drwxr-xr-x 6 tom tom 4096 Oct 13 22:05 8tbstorage
I know this is permissions related but I don’t know how to fix it without potentially making a mess of them so I am reaching out for help. I’m also not sure what I should put for ChrootDirectory. One thought that crossed my mind was adding my admin user I made to the owner group for /media, but that is a guess.
Read more here: Source link
