I want to add a sftp user to access /var/www/html directory only, without ssh login permission.Tried many tutorials available across internet but no one is working. However same method working on LAMP server but not working with litespeed installed vps.
Can anyone help in this, how you guys are creating ftp users?
I`m so frustrated after reading so many users in difficulty, and surprised about the fact that nobody is willing to provide proper explanations for the sake of 2 minutes and 5 lines...
The issue here is that for example on OpenLitespeed, the /var/www directory is owned by user nobody. As such, you need to create a virtual ftp user and change the owner whilst still leaving nobody to access it.
Assuming you are using Pure-FTP and PureDB enabled, create the user without SSH login first:
Bash:
useradd -d /var/www -s /sbin/nologin ftpuser && echo 'ftpuser:VERYSTRONGPASSWORD' | sudo chpasswd
Then create a Pure-FTP virtual user:
Bash:
pure-pw useradd storeftp -u ftpuser -d /var/www -m
Then rebuild the Pure-FTP database:
And finally change the ownership:
Bash:
chown -R ftpuser:nobody /var/www/
Optionally update permissions too (if you cannot write to it):
With the above you will be able to have FTP users accessing the /var/www without SSH login.