Networking Forums

Networking Forums > Computer Networking > Linux Networking > make SFTP readonly

Reply
Thread Tools Display Modes

make SFTP readonly

 
 
FJY
Guest
Posts: n/a

 
      11-27-2003, 07:06 AM
Hi,

I'm using RH9 with openssh-3.5p1-6. My Linux box provides sftp service. Is
there a way to prevent sftp users from using "rm" command? The users are
allowed to upload files so I can't disable the write permission on the disk.
But I don't want the files on the server to be wiped by an sftp user. If a
user uses ssh shell and tries to remove a file, it's easy to thwart this by
modifying /bin/rm. However, this doesn't work if the user removes the file
using a sftp client. Anyone knows a solution? Thank you in advance.

FJY


 
Reply With Quote
 
 
 
 
Ed Murphy
Guest
Posts: n/a

 
      11-27-2003, 07:29 AM
On Thu, 27 Nov 2003 08:06:35 +0000, FJY wrote:

> I'm using RH9 with openssh-3.5p1-6. My Linux box provides sftp service. Is
> there a way to prevent sftp users from using "rm" command? The users are
> allowed to upload files so I can't disable the write permission on the disk.
> But I don't want the files on the server to be wiped by an sftp user. If a
> user uses ssh shell and tries to remove a file, it's easy to thwart this by
> modifying /bin/rm. However, this doesn't work if the user removes the file
> using a sftp client. Anyone knows a solution? Thank you in advance.


You probably want to prevent them from overwriting files as well. I think
the solution is to place them within a chroot jail. (No, I don't actually
know *how* to do that. Sorry.)

 
Reply With Quote
 
Andrew Schulman
Guest
Posts: n/a

 
      11-27-2003, 08:28 AM
<posted & mailed>

> I'm using RH9 with openssh-3.5p1-6. My Linux box provides sftp service. Is
> there a way to prevent sftp users from using "rm" command? The users are
> allowed to upload files so I can't disable the write permission on the
> disk.


One solution would be to provide a single "upload" directory, where users
can upload their files. Someone with enough authority can move them later
to their proper locations. This directory can be world-writeable, but with
the sticky bit set (mode 1777) so that only a file's owner (or root) can
delete it. All other directories can be made non-writeable.

It seems to me that this isn't really an SFTP problem, it's a general
permissions problem. Once a user is authenticated, they have the same
permissions as if they were sitting at the console typing "rm". So your
problem really is: how can you allow your users (regardless of how they've
signed in) to create new files, but not delete other people's files? The
sticky bit is a common solution to this problem. See man chmod and search
for "sticky".

Good luck,
Andrew.

--
To reply by email, change "deadspam.com" to "alumni.utexas.net"

 
Reply With Quote
 
FJY
Guest
Posts: n/a

 
      11-27-2003, 04:26 PM
"Andrew Schulman" <(E-Mail Removed)> wrote in message
news:bq4g12$1tsh3t$(E-Mail Removed)...
> <posted & mailed>
>
> > I'm using RH9 with openssh-3.5p1-6. My Linux box provides sftp service.

Is
> > there a way to prevent sftp users from using "rm" command? The users are
> > allowed to upload files so I can't disable the write permission on the
> > disk.

>
> One solution would be to provide a single "upload" directory, where users
> can upload their files. Someone with enough authority can move them later
> to their proper locations. This directory can be world-writeable, but

with
> the sticky bit set (mode 1777) so that only a file's owner (or root) can
> delete it. All other directories can be made non-writeable.
>
> It seems to me that this isn't really an SFTP problem, it's a general
> permissions problem. Once a user is authenticated, they have the same
> permissions as if they were sitting at the console typing "rm". So your
> problem really is: how can you allow your users (regardless of how

they've
> signed in) to create new files, but not delete other people's files? The
> sticky bit is a common solution to this problem. See man chmod and search
> for "sticky".
>
> Good luck,
> Andrew.
>
> --
> To reply by email, change "deadspam.com" to "alumni.utexas.net"


Thanks a lot! But the real situation is much more complicated than what I've
posted. I use both vsftpd and sftp (sshd) to provide FTP service. In vsftpd,
I use PAM for authentication, so actually all users share a common account
("virtual" account, as in the vsftp sample) on Linux. There's no way to tell
who puts what in the home directory (/home/virtual). Thus in vsftpd I
disallow write operations other than uploading and creating directory.
However, considering some users might want to modify (rename or move) their
uploaded files, I allow them to use sftp (sshd). But I don't want them to
use the sftp command "rm" specifically for the known reason. Is it possible
to get this around? Any help will be greatly appreciated.

FJY


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get sftp more secure? tech11 Linux Networking 1 10-17-2007 11:27 AM
Lock/readonly replica ?? marsias Windows Networking 1 05-09-2007 10:27 AM
How do I make make a network boot floppy? Boe Windows Networking 3 05-23-2006 11:37 PM
SFTP packet? Peter Linux Networking 1 02-16-2005 09:00 AM
SFTP & FTP transfert rate Paul Linux Networking 4 05-28-2004 01:11 PM



1 2 3 4 5 6 7 8 9 10 11