# <SLOVED> SSH + chmod

## Sephiroth81

Hi. There ara users who connect to my server via ssh using FileZilla. They often copy some files to server. The directory where those files are copied is shared in local network. The problem is that users cannot delete those files, because after copying those files rights are set to 644. How can I set it, so the files rights are automticaly set to 777(for example).Last edited by Sephiroth81 on Wed Jan 04, 2006 12:14 pm; edited 1 time in total

----------

## Voorhees51

what FTP server are you running, and possibly post your config so that we can have more info to help you with

----------

## Sephiroth81

All users connect to sshd deamon using sftp. What files should I post ? I use rssh to chroot them into one specific directory

----------

## Voorhees51

a simple fix is to write a script that runs that will chmod all the file permissions of the files in the directory to what you want them to be.

  I'm not exactly sure how to default set permissions for sftp to use though.

----------

## Sephiroth81

Could any of You write down such a script?

----------

## frenkel

 *Sephiroth81 wrote:*   

> Could any of You write down such a script?

 

If that directory is mounted on a seperate drive, you could set umask for it. IIRC umask sets default permissions for files created on that drive.

----------

## Sephiroth81

This directory is on separate partition and it's mounted to /home/files.

So how can I set those default permissions ??

----------

## frenkel

 *Sephiroth81 wrote:*   

> This directory is on separate partition and it's mounted to /home/files.
> 
> So how can I set those default permissions ??

 

In your fstab, something like this will work I think:

 *Quote:*   

> 
> 
> /dev/hda7       /mnt/files           xfs             logbufs=8,noatime,umask=0000
> 
> 

 

This will make al files created have the default permission 0666.

Also see

$ man umask

Good luck!

----------

## Sephiroth81

It does not work  :Sad: 

I also tried to use cron to chmod all files in this folder. I added this to crontab :

```

1  *  * * * /bin/chmod -R 666 /home/dokumenty/

```

but it also does not work  :Sad: 

----------

## frenkel

 *Sephiroth81 wrote:*   

> It does not work 
> 
> I also tried to use cron to chmod all files in this folder. I added this to crontab :
> 
> ```
> ...

 

The umask thing should work, it works here, did you remount the disk after adding the changes to your fstab?

----------

## Sephiroth81

Yes I've remounted this partition. But I've found the solution. I've changed umask in rssh.conf an now it's working  :Smile: 

But thanks for the tips

----------

## frenkel

Ok, glad it's working, didn't know ssh bypassed the umask option in fstab. I don't use umask for ssh, it was just local that I tested it.

----------

