Newly created/copied files not inheriting parent directory's permission.

Posted on 2007-10-17
Medium Priority
Last Modified: 2013-12-16
Environment: ESX 3

Attempting to:  USe WinSCP382 (logged on as root) to copy files from Windows PC up to ESX host.

Issue: When copying the new files to the /vmfs/volumes/volume1 directory, the default file permissions applied to the building temp file file are: rw-r--r--.  This causes copying problems when the copy process finishes and the program tries to rename the temp file with the original's name.

What I have done:  Very little because I am new to Linux.  However, I did attempt to use WINSCP382's ability to force the proper permissions, but that does not work.  I also did logged on with a puTTY session as root, navigated to the directory in question and did the following:
1. Performed an LS -L command and saw that the directory in question is set to: rwxrwxrwx
2. Created a new file from inside the puTTY session, using ECHO "test" > TEST.  This created a new file called TEST and it still had the rw-r--r-- file permissions.

Is there a system variable that I have to change in order to force all newly created files to use the directories file permissions?
Question by:jedifenner

Expert Comment

ID: 20095124
It's not the way it is in unix (well, most of it). you will have to do it by hand or use the chmod inside winscp, as far as I know.
LVL 14

Expert Comment

ID: 20096189
What you need to do is set the umask on the server, which is what is read to determine new file settings.

Edit sshd_config  in /etc/ssh on the server.  Change
Subsystem   sftp    /usr/libexec/openssh/sftp-server
Subsystem sftp /opt/sftp-server.sh

Now create /opt/sftp-server.sh and put this in it:
umask 002

And then chmod 755 /opt/sftp-server.sh

The umask subtracts from 777, so 002 will end up 775, which is what you want.

Author Comment

ID: 20101143
Changing them manually is not an option because it breaks my copy process.  I am no Linux guru, FAR FROM IT in fact, but I cannot believe the Linux community would make something as simple as file copying/new file creation/permissions assignment a manual task.  Just doesn't make sense!  New files should inherit the permissions from their parent directory.

Anyhow, arrkerr, I have done all that you stated with the sftp-server.sh file.  I have confirmed the sh file has the following permissions: -rwxr-xr-x.  However, I still cannot create a new file without it setting the default permissions to rw-r--r--.  Do I need to restart the box or a service?  Please indicate whether doing so will affect a running ESX 3 environment as this is a production server.

Thanks for you help!
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.


Accepted Solution

jedifenner earned 0 total points
ID: 20147914
It appears this is a known issue with using WinSCP to copy files to esx vmfs drives.  Going into the options-->programs-->transfer-->resume, disable Tranfer Resume For.  This will allow your copies to complete.

Author Comment

ID: 20147929
This question can be closed.

Expert Comment

ID: 20898545
Closed, 125 points refunded.
Community Support Moderator

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ransomware is a malware that is again in the list of security  concerns. Not only for companies, but also for Government security and  even at personal use. IT departments should be aware and have the right  knowledge to how to fight it.
Often times it's very very easy to extend a volume on a Linux instance in AWS, but impossible to shrink it. I wanted to contribute to the experts-exchange community a way of providing a procedure that works on an AWS instance. It can also be used on…
This Micro Tutorial walks you through using a remote console to access a server and install ESXi 5.1. This example is showing remote access and installation using a Dell server. The hypervisor is the very first component of your virtual infrastructu…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question