I've setup a chroot environment for sftp access (sftp only, no shell).
The sftp user needs rw access to a host directory. I mounted it via /etc/fstab
/var/www/html /home/sftp-user/jail/html none bind 0 0
When I do df -h
I get the following output:
Filesystem Size Used Avail Use% Mounted on
[...]
/dev/sda1 75G 65G 7,7G 90% /
[...]
For du -sh
I get the following:
# du -sh /* 2> /dev/null | sort -h
0 /bin
0 /dev
0 /initrd.img
0 /lib
0 /lib32
0 /lib64
0 /libx32
0 /proc
0 /sbin
0 /sys
0 /vmlinuz
4,0K /mnt
4,0K /opt
4,0K /srv
8,0K /media
16K /lost+found
44K /tmp
4,4M /etc
52M /boot
81M /run
1,4G /usr
13G /root
15G /home
36G /var
But the 15GB in home only come from the jail
# du -sh /home/sftp-user/jail/* 2> /dev/null | sort -h
15G /home/sftp-user/jail/html
My understanding of the mount was, that it was more like a symlink, so the disk space is not really used. Is it?
I'm pretty sure I tried to solve that with a symlink first, but something wasn't working that's why I'm using mount now. Unfortunately I forgot what exactly the problem with a symlink was. I think the sftp user had no access to the host folder through that symlink.
Is there a better solution either to get the symlink to work or to show the real used disk space?
Edit for clarification:
I don't get why /dev/sda1
seems so full. /var/www/html
and /home/sftp-user/jail/html
are both on /dev/sda1
. I have nothing else in my /home
, only that mount. So practically the real size of it should be only some bytes.
So when adding up the sizes of /usr
, /root
, /home
and /var
(1,4+13+15+36) I get ~65G. But the actual location of the 15GB of the /home
-files is in /var
, so the used disk space which df shows should only be ~50G (1,4+13+36).