How to change ftp path?
Solution 1
When you login as a user, vsftp will default to putting you in that user's home directory. If you want to ftp to linux-server and have it drop you into /var/www
, the easiest way would be to create an FTP user who's home directory is set to /var/www
.
Alternately, a better solution might be to setup anonymous FTP, and make the anonymous FTP directory be /var/www/
(assuming you don't need it to be restricted and secured (of course, if you do, you should be using ssh/scp/sftp)).
Solution 2
the anonymous FTP directory is /var/ftp/
. If you want to change it to another directory, do:
sudo vi /etc/vsftpd.conf
or in some cases:
sudo vi /etc/vsftpd/vsftpd.conf
and edit this variable:
anon_root=/NewDirectoryPath/ftp/
Related videos on Youtube
JD Isaacks
Author of Learn JavaScript Next github/jisaacks twitter/jisaacks jisaacks.com
Updated on September 17, 2022Comments
-
JD Isaacks over 1 year
I have apache installed on my ubuntu machine. you can access the server from other machines with
http://linux-server
The local path on the machine is/var/www
I have installed vsftpd on the machine as well so I can ftp to the server from another machine withftp://linux-server
however it takes me to/home/myUserName
I want the ftp to take me to the same place as the http. So how can I change the FTP path?Thanks!
-
JD Isaacks about 14 yearsthanks, can you go into further detail about how to add a new user and set its home directory to /var/www. Thanks!!
-
Christopher Karel about 14 years'useradd' is the command you want.
useradd -d /var/www newuser
will create an account named 'newuser', with the correct home directory. Then usepasswd newuser
to change the account name. This all assumes you have root on the box.