Ftp server - file copy permission issue

ma_do0699 Posted messages 10 Status Member -  
mamiemando Posted messages 33228 Registration date   Status Moderator Last intervention   -
Hello,

We have a Linux FTP server on which I created an account that allows access to a folder to upload files only, but I’m having a permission issue copying from my workstation to the server via WinSCP.

Here are the commands I used:

cd /home
mkdir %nom_du_repertoire%
useradd %nom_de_connexion% -p %mot_de_passe% -d /home/%nom_du_repertoire%/ -s /bin/false
chmod 755 %nom_du_repertoire%
chown %nom_de_connexion%:%nom_de_connexion% /home/%nom_du_repertoire%

and in the file /etc/proftpd/proftpd.conf

#VALID LOGINS

AllowUser %nom_de_connexion%

and added the following lines

%nom_du_repertoire%>
Umask 022 022
AllowOverwrite off

DenyAll

I thought that if I added rights directly on the folder via WinSCP it would work but no

A little help?

thanks

Configuration: Windows / Firefox 52.0

1 answer

mamiemando Posted messages 33228 Registration date   Status Moderator Last intervention   7 940
 
Hello,

proftpd is an FTP server, so what it offers applies to FTP clients.
winscp is an SSH client, so it is governed by what the SSH server on the machine exposes to it.

If you have a permission problem with the user you used with your SSH client (here winscp) have sufficient rights to write the file in the destination directory "as if" it were authenticated directly on the machine.

For example, on a Linux machine, a user named toto has write rights in
/tmp
and in
/home/toto
. These are therefore the only two directories (disregarding their subfolders) in which they can write with SSH:

scp mon_fichier toto@machine:/home/toto/


Generally on Linux, we do not relax permissions on a file, as this often creates a security hole (especially when dealing with system-related files). This means that
chmod
and
chown
should never be used to "increase" a user's rights. Instead, we will raise the user's rights, for example by adding them to the appropriate group.

In your case, we could imagine for example that you create a directory
/uploads
that belongs to the group upload, and add toto and tata to this group. Then make this directory belong to the group upload and grant write rights to this directory.

Good luck
0