File permission mask setting

Advertisement

Halfgaar
Guest

File permission mask setting

Hi,

I was wondering if there is a way to have the file permissions of every file copied set to 0770 (for example). I'm looking for a server-side setting. The .bash_profile doesn't seem to be read by WinSCP, so I can't use umask 0770, or can I somehow?

Thanks in advance,

Halfgaar

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,444
Location:
Prague, Czechia

Re: file permission mask setting

You may specify some script, which does the settings and finally launches shell, instead of actual shell on Shell tab of login dialog. But in fact, AFAIK, SCP protocol ignores umask :-(. Why don't you use "Set permissions" setting on copy confirmation dialog?

Reply with quote

Halfgaar
Guest

Re: file permission mask setting

martin wrote:

Why don't you use "set permisssions" setting on copy confirmation dialog?
Because the server is accessible through Samba as well, as another user but in the same group. And on top of that, the fileserver is going to be synchronised with another tool called unison, a tool like rsync, but is supports two way mirroring. I need the guarantee that every file has the correct permissions, or else strange things will happen :)

Reply with quote

Jay
Guest

Re: file permission mask setting (fixed)

Could you let the rest of us know what your workaround is? I'm having the same problem with the program ignoring the umask setting.

Yes, with the newer versions of WinSCP you can change permissions on the transfer confirmation dialog, but that requires the user to take an action. The whole point of the umask is that, unless the user takes an action, you get the right permissions.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,444
Location:
Prague, Czechia

Re: file permission mask setting (fixed)

First of all: I was wrong stating that SCP protocol ignores umask, it does not.
Quote from comp.security.ssh:
If you read the bash man page section entitled "INVOCATION," you will find
that bash only sources the login files (.profile, .bash_profile, etc.) on
interactive logins, regardless of whether the shell is invoked as a login
shell or not (which it is by sshd). scp runs ssh in a subprocess to start
another copy of scp as a remote command, which does not allocate a tty, so
this counts as a non-interactive login.

Put the umask command in .bashrc instead.

Reply with quote

Halfgaar
Guest

Re: file permission mask setting (fixed) + workaround

Firstly, I'm sorry for my late reply.

Secondly, the thing with bashrc, impossible. I've tried everything and everything on the google groups. (Win)SCP seems to be ignoring it. I also read something (I believe the same dude which wrote the piece of text prikryl quoted said so) about someone having problems with getting it to work with bash. He recommendes CSH instead. But I'm not going to switch shell...

Then, my workaround: The fileserver is also accessible with samba, for local users. Samba can set permissions and owners perfectly. So what I did, was mount the samba share through loopback and gave the remote-access user that mountpoint as home dir. The downside is, that setting permissions is disabled completely like this.

If anything is unclear, let me know :)

Halfgaar

Reply with quote

Advertisement

You can post new topics in this forum