LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   SFTP user creation without SSH (https://www.linuxquestions.org/questions/linux-newbie-8/sftp-user-creation-without-ssh-4175463919/)

jithinsha 05-29-2013 05:19 AM

SFTP user creation without SSH
 
I need to create a user who can login using sftp and refuse login with ssh. When logged in using sftp, the access directory should be /var/www/html but the user must not be able to go backwards ie from html to www and so on. Also the user must be able to upload contents to html folder directly.

My Current status

I have created the user and have configured ssh so that the user gets only sftp access and the access directory is /var/www/html and the user can't move backwards. Until this i have referred various sites to work out. But now am finding it difficult to configure the upload permissions. I hope some one can give me a fair idea.

AbidDhanaiser 05-29-2013 05:25 AM

use adduser <username >
or
use useradd <username >

bloodstreetboy 05-29-2013 05:27 AM

Why don't you install ftp?

It fulfills your all requirements.

mjm295 05-29-2013 05:29 AM

have a read of chroot, make /var/www/html the root dir for the user, then they cannot go backwards.

chrism01 05-29-2013 06:09 AM

So, everything is working except
Quote:

But now am finding it difficult to configure the upload permissions
Can you tell us exactly what you are trying to achieve and what difficulties you are having.

jithinsha 05-29-2013 10:43 AM

Quote:

Originally Posted by chrism01 (Post 4961252)
So, everything is working except

Can you tell us exactly what you are trying to achieve and what difficulties you are having.

My requirement is that the user should be able to create contents and change contents when uploading to /var/www/html. The situation is that we need to chroot to block the reverse access and that is done to /var/www and the user is given the ownership to /var/www/html so that he can upload contents over there (permissions). But when given so the user is getting logged in to www folder and not to html. Am checking if the chroot can be done to www and login configured to html. Also when uploading if the same file uploaded again, usually its prompted to replace, but unfortunately that gets failed. May be permission issues.

chrism01 05-30-2013 08:17 PM

1. Just set the login to the chroot dir.

2. Please give example (not description) of upload/perms issue ie show entire session.
Try
Code:

ls -l

ls -Z

on target dir and contents.

jithinsha 05-31-2013 05:51 AM

Quote:

Originally Posted by chrism01 (Post 4962479)
1. Just set the login to the chroot dir.

2. Please give example (not description) of upload/perms issue ie show entire session.
Try
Code:

ls -l

ls -Z

on target dir and contents.

ls -ld /var/www/html/
drwxr-xr-x. 5 pop test 4096 May 25 11:07 /var/www/html/

ls -ld /var/www/
drwxrwx--x. 7 root root 4096 May 21 15:28 /var/www/


Everything is working fine except uploading contents to html folder and the direct access to html folder when logging in.


All times are GMT -5. The time now is 11:30 AM.