Score:1

How to add a specific path for FTP user home?

cn flag

I installed recently vsftpd and added a user called ftpuser. I created the /etc/vsftpd.conf file from scratch with the following info:

listen=YES
listen_ipv6=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
local_root=/mnt/md0
secure_chroot_dir=/mnt/md0
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO
pasv_enable=Yes
pasv_min_port=10000
pasv_max_port=10100
allow_writeable_chroot=YES

I also added the ssh server for sftp connections. I managed to login just fine but whenever I log in, I don't see the desired drive which is located in /mnt/md0 but the generic ftp user homefolder. In fact I see both ftpuser and the homefolder for the admin which is not to be desired.

So how can I tell vsftpd.conf to show the ftpuser only the /mnt/md0 exclusively?

I tried so far: sudo adduser ftpuser --home /mnt/md0 Warning: The home dir /mnt/md0 you specified already exists. adduser: The user `ftpuser' already exists.

Thanks!

edit:

sftp -P 2222 -vvvvvvv ftpuser@PUBLIC IP

shows

...
debug3: Sent message fd 3 T:16 I:1
debug3: SSH_FXP_REALPATH . -> / size 0
sftp> ls
debug3: Sending SSH2_FXP_READDIR I:3
debug3: Received reply T:104 I:3
debug3: Received 4 SSH2_FXP_NAME responses
debug3: Sending SSH2_FXP_READDIR I:4
debug3: Received reply T:101 I:4
debug3: Received SSH2_FXP_STATUS 1
debug3: Sent message SSH2_FXP_CLOSE I:5
debug3: SSH2_FXP_STATUS 0
ftpuser  su       
sftp> cd ftpuser
debug3: Sent message fd 3 T:16 I:6
debug3: SSH_FXP_REALPATH /ftpuser -> /ftpuser size 0
debug3: Sent message fd 3 T:17 I:7
debug3: Received stat reply T:105 I:7
sftp> ls
debug3: Sending SSH2_FXP_READDIR I:9
debug3: Received reply T:104 I:9
debug3: Received 9 SSH2_FXP_NAME responses
debug3: Sending SSH2_FXP_READDIR I:10
debug3: Received reply T:101 I:10
debug3: Received SSH2_FXP_STATUS 1
debug3: Sent message SSH2_FXP_CLOSE I:11
debug3: SSH2_FXP_STATUS 0
FTP-TEST  
cn flag
That is done with `local_root=/mnt/md0` + `allow_writeable_chroot=YES` + `chroot_local_user=YES` so you might have a different problem then you think. Try to connect from command line and add `-vvvvvvv` as an option. That will echo tons of info on screen. Don't forget to restart `vsftpd` though :)
cn flag
The part behind those flags is more important ;) remove the comment! no idea if there is any private data in there ;-) I have copied the last part that I would consider important from it. I did not see any issues in there :) `sftp> cd ftpuser` is probably the important one (and `SSH_FXP_REALPATH /ftpuser -> /ftpuser size 0`)
Nameless avatar
cn flag
I think I omitted private data! The issue is the fact that I can LOG IN but the home path is not what is supposed to be. It's not the /mnt/md0 drive/folder combo. It's the standard ftp directory.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.