sftp permissions


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers sftp permissions
# 1  
Old 12-12-2009
sftp permissions

Hi

I've been banging my head with this problem for two days, and I'm quite hopeless.

First of all, i would like to insist that no samba is involved.

I have a bunch of users whose home directory is /home/SFFS . Always. All of them. And they all belong to the group sffs.
Permissions of /home/SFFS look like this :
233360 drwxrwsr-x 3 root sffs 96 2009-12-12 16:03 . Notice that I have chmodded it to g+s.

1 - SSH only

When I set /bin/bash to be their shell, they can log in via ssh, add files, etc.
Permissions of files added via ssh are -rw-rw-r--, which is GOOD. I want that.

2 - FTP only

this is not very important, but users are not in the right directory (which is empty, so I cannot figure out which one it is). They cannot create anything. I'll live with it.

3 - SFTP - the weirder part.

when I set /usr/lib/sftp-server to be the user's shell, they can :
log in : yafc sftp://user@localhost/
list files
create new files
etc.

BUT (and this is my point) the files they create is set with permissions g-w !!! (more precisely, -rw-r--r--. So users cannot overwrite files created by others.

If I rerun sudo chmod g+ws on /home/SFFS, it will work, but this is not an option (trust me)

Since ssh works perfectly well, I assume the problem comes from vsftpd. Here are parts of my /etc/vsftpd.conf (I'm on ubuntu, if it changes anything) :
Code:
local_enable=YES
write_enable=YES
local_umask=0000        obviously this is not taken into account
file_open_mode=0777
chroot_local_user=YES
user_config_dir=/home/SFFS
chmod_enable=YES

Sorry for the text wall. I really hope someone could figure this out.
++
# 2  
Old 12-12-2009
I am somewhat confused. Do you want your users to be able to access this directory via sftp or via an vsftpd server? sftp and vfstp are completely different packages.
# 3  
Old 12-12-2009
Well, sftp = ftp + ssh. FTP is provided by vsftpd, ssh by openssh. This is different from ftps (ftp over ssl)

`aptitude search sftp` has no package named sftp anyway. And this part actually works : I just have a permissions problem.
# 4  
Old 12-13-2009
Quote:
Since ssh works perfectly well, I assume the problem comes from vsftpd.
ssh and vsftpd have nothing to do with each other. If you are having a problem with sftp it has nothing to do with vsftpd.

Have you set the PermitUserEnvironment option? See sshd_config(5).
# 5  
Old 12-13-2009
Quote:
Originally Posted by Calvin1602
3 - SFTP - the weirder part.

when I set /usr/lib/sftp-server to be the user's shell, they can :
i don't think you have to do this. from the sftp-server man page.

Quote:
DESCRIPTION
sftp-server is a program that speaks the server side of SFTP protocol to
stdout and expects client requests from stdin. sftp-server is not in-
tended to be called directly, but from sshd(8) using the Subsystem op-
tion.

Command-line flags to sftp-server should be specified in the Subsystem
declaration. See sshd_config(5) for more information.
just set the user shell to bash or other shells that your environment allowed to be used. try to check umask settings and set it appropriately.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Sftp change file permissions

Hi All, Apologies if this question has been asked before. I havent been able to resolve an issue and would like some help. I am getting files pushed to me via sftp. The files once pushed to my server in folder ABC have -rw------- but I need these files to have the following -rw-rw---- to be... (1 Reply)
Discussion started by: israr75
1 Replies

2. Red Hat

Sftp server/chrooted trying to limit user permissions

I needed to set up an sftp server for an external user to upload data for an internal developer. What I did was created a chrooted user for the external guy, and then created an internal group with full permissions to that directory and then made the internal developer a member of that group so... (5 Replies)
Discussion started by: xdawg
5 Replies

3. Shell Programming and Scripting

Needed SFTP script from windows to UNIX server and from UNIX to windows server(reverse SFTP)

hi guys, i need a script to sftp the file from windows to unix server ....(before that i have to check whether the file exists in the windows server or not and again i have to reverse sftp the files from unix to windows server..... regards, Vasa Saikumar. (13 Replies)
Discussion started by: hemanthsaikumar
13 Replies

4. Shell Programming and Scripting

Sftp : not able to print the echo statements after the sftp transfer

I had the below sftp script working perfectly but the problem is I am not able to send the echo statements . #!/bin/sh echo "Starting to sftp..." sftp admin@myip << END_SCRIPT cd /remotepath/ lcd /localpath/ mget myfiles*.csv bye END_SCRIPT echo "Sftp successfully." echo echo... (11 Replies)
Discussion started by: scriptscript
11 Replies

5. Solaris

How do files transferred via ftp or sftp gets thier permissions at destination?

We have umask defined under /etc/.login as 022. I have my user specific umask defined in /userhome/.login as 002. I understand ftp will not execute anything at destination, it simply transfers files. But it seem to be using 022 as umask for the files transferred. How does ftp knows what umask... (4 Replies)
Discussion started by: kchinnam
4 Replies

6. Red Hat

Chroot sftp users, remote sftp login shows wrong timestamp on files

Hello, I have a weird issue, I have RHEL 5.7 running with openssh5.2 where sftpgroup OS group is chroot. I see the difference difference in timestamp on files, when I login via ssh and SFTP, I see four hour difference, is something missing in my configuration. #pwd... (8 Replies)
Discussion started by: bobby320
8 Replies

7. Shell Programming and Scripting

SFTP-how to log individual sftp command error while executing shell script

Hi, I have situation where i need to automate transferring 10000+ files using sftp. while read line do if ; then echo "-mput /home/student/Desktop/folder/$line/* /cygdrive/e/folder/$line/">>sftpCommand.txt fi done< files.txt sftp -b sftpCommand.txt stu@192.168.2.1 The above... (1 Reply)
Discussion started by: noobrobot
1 Replies

8. Shell Programming and Scripting

ksh; Change file permissions, update file, change permissions back?

Hi, I am creating a ksh script to search for a string of text inside files within a directory tree. Some of these file are going to be read/execute only. I know to use chmod to change the permissions of the file, but I want to preserve the original permissions after writing to the file. How can I... (3 Replies)
Discussion started by: right_coaster
3 Replies

9. AIX

SFTP Failed---Request for subsystem 'sftp' failed on channel 0

Hi, While I am trying SFTP my machine to another unix machine , it was working fine till 10 min back. But now i am getting the below error "Request for subsystem 'sftp' failed on channel 0" Could you please someone help me to solve or analyise the root cause... Cheers:b:, Mahiban (0 Replies)
Discussion started by: mahiban
0 Replies

10. HP-UX

To give the "unzip" permissions & "create" file permissions

Hi, I am a Unix Admin. I have to give the permissions to a user for creating new file in a directory in HP-Ux 11.11 system since he cannot able to create a new file in the directory. Thanks in advance. Mike (3 Replies)
Discussion started by: Mike1234
3 Replies
Login or Register to Ask a Question