What's new

FTP - hide others folders

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

fuxx

New Around Here
Hello,

I configured ftp with ssl on my RT-AX58U, but after creating a user with r/w rights, when he connected to the server he can see all the directories, but he can enter the directory where has those rights. How can I change the default directory for this user so that when he connects he immediately enters the directory he has rights to? This user have only rights to NAS directory but he see all others directories.

Tree folders for example:
1647954146660.png
 
The firmware doesn't hide the other top-level directories and doesn't have an option that allows you to specify custom home directories.

You could create a custom config file for vsftpd that sets a user's home directory.
 
I tried to use
Code:
user_config_dir=/jffs/configs/vsftpd.users
passwd_file=/jffs/configs/vsftpd.passwd

But unfortunately after typing this into vsftpd.conf.add on jffs/config the FTP server can't start.
 
Try this quick and dirty test.

Delete your vsftpd.conf.add file and create this /jffs/scripts/vsftpd.postconf file instead:
Code:
#!/bin/sh

CONFIG=$1
source /usr/sbin/helper.sh

# Custom home directories
pc_append "user_config_dir=/etc/vsftpd_user_conf" $CONFIG
mkdir -p /etc/vsftpd_user_conf
echo "local_root=/mnt/ClickUSB1/ASUS" > /etc/vsftpd_user_conf/Colin
Obviously change the echo statement to reflect your own path and username.
Remember to chmod 755 /jffs/scripts/vsftpd.postconf and then service restart_ftpd.

EDIT: Put user_config_dir in /etc rather than /jffs as there's no point in it being in persistent storage just for this simple case.
EDIT2: Minor change to path names for brevity and consistency with man page example.
 
Last edited:
Unfortunately, it doesn't work. I created a script file, put it in jffs/scripts and set read rights. The script does not work and does not even create the user_config folder in jffs. Thank you so much, for trying to help.

Bash:
#!/bin/sh


CONFIG=$1
source /usr/sbin/helper.sh


# Custom home directories
pc_append "user_config_dir=/jffs/vsftpd/user_config_dir/" $CONFIG
mkdir -p /jffs/vsftpd/user_config_dir
echo "local_root=/mnt/STOREJET/NAS/" > /jffs/vsftpd/user_config_dir/public
 
Did you enable custom scripts? (Administration > System > Enable JFFS custom scripts and configs = Yes)
 
Yes. I have enable amtm and have installed diversion. In administration i have enabled scripts on jffs without format. Others script like dnsmasq.postconf is working fine.
 
Hmm, and you used a Linux editor to create the file, not a Windows editor?

Just to be sure type:
Code:
dos2unix /jffs/scripts/vsftpd.postconf
service restart_ftpd
 
Yes, almost ok :) It goes straight into the NAS folder after connection and could stay that way, but unfortunately you can go back to previous folders.
1647977880884.png
 
... but unfortunately you can go back to previous folders.
Yes, there's nothing you can do about that unfortunately. The best you can do is set the permissions on the other shares for that user to "No" in the GUI. That way they can see the share name but can't access it.

Untitled.png
 
Last edited:
Hmmm... this function was better resolve on Tomato firmware in my Asus RT-AC56U. But thank you for help :)
 

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top