Src = SJOAM    
Dest = sjoam2

Connecting to a ftp server, get a file from it.

On ftp server side.

[oracle@SJOAM ~]$ ls -l total.zip 
-rwxrwxr-x. 1 oracle oinstall 412 Aug  8 09:03 total.zip

On client side connecting to ftp server

[grid@sjoam2 ~]$ umask
0002  -- take note of the permission
[grid@sjoam2 ~]$ ftp
Connected to (
220 Welcome to SJOAM Network
Name ( oracle
331 Please specify the password.
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> get total.zip
local: total.zip remote: total.zip
227 Entering Passive Mode (192,168,1,25,45,116).
150 Opening BINARY mode data connection for total.zip (412 bytes).
226 Transfer complete.
412 bytes received in 0.000105 secs (3923.81 Kbytes/sec)
ftp> exit
221 Goodbye.
[grid@sjoam2 ~]$ ls -l
total 4
-rw-rw-r--. 1 grid grid 412 Aug  8 18:28 total.zip
[grid@sjoam2 ~]$ 

Take note of the permission of the file in both the server and client. The file retrieved's permission is adjusted to the umask of the client.

However, if we are to scp the file from server to the client, the permission will remain as of the server's.

[oracle@SJOAM ~]$ ls -l total.zip 
-rwxrwxr-x. 1 oracle oinstall 412 Aug  8 09:03 total.zip
[oracle@SJOAM ~]$ scp total.zip [email protected]:/home/grid/
[email protected]'s password: 
total.zip                                     100%  412     0.4KB/s   00:00    
[oracle@SJOAM ~]$ 

See file permission below in client, it is the same as the server's

[grid@sjoam2 ~]$ ls -l
total 4
-rwxrwxr-x. 1 grid grid 412 Aug  8 09:03 total.zip
[grid@sjoam2 ~]$ 


In http://docstore.mik.ua/orelly/networking_2ndEd/ssh/ch07_05.htm, it states that by default the file permissions adhere to a umask on the destination host

7.5.4. Preserving Permissions

When scp copies files, the destination files are created with certain file attributes. By default, the file permissions adhere to a umask on the destination host, and the modification and last access times will be the time of the copy. Alternatively, you can tell scp to duplicate the permissions and timestamps of the original files. The -p option accomplishes this:

For my case, the destination file permission adheres to that of the source and not its umask.

What's wrong? Or am I understanding wrongly?

2 Answers 2


Your example shows that you specified -p which the quoted documentation explains copies the file permissions from the source instead of using umask. Remove the -p flag if you want to use the umask instead.

  • even without -p, results are the same. i have edited my post. tried sending from server, and getting from server using scp. both retain the permission on the source. umask is not used.
    – Noob
    Aug 9, 2015 at 12:38

Your umask is set to 0002, which means it will mask out write permissions for others.

In both your examples, the file created is not writable by others.

It's working properly.

  • how is it working properly ? when using ftp source = -rwxrwxr-x , destination = -rw-rw-r-- (this is correct for umask 002) but when using scp, source = -rwxrwxr-x but destination is still = -rwxrwxr-x
    – Noob
    Aug 10, 2015 at 16:57
  • What leads you to believe that ftp preserves file permission settings? Aug 10, 2015 at 17:09
  • i didn't believe that it preserves file permission, in fact it doesn't. the source file's permission and the file's permission at the destination (after ftping in and get the file) is different. which leads me to think that umask is applied on the destination - which is correct. but SCP preserves the file permission from the source to the destination (even without the -p), which i dont understand why umask isn't applied in the SCP scenario
    – Noob
    Aug 10, 2015 at 17:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .