set default file permissions for a directory

William D Ricker wdr at TheWorld.com
Sun Dec 11 19:38:00 EST 2005


> From: Numberwhun [snip]
> when you ar[e] specifying where you want to transfer to you 
> need to spe[c]ify the following:
>     user@<ip or machine name>:/directory/on/other/machine

Just tO be precise, any of the source file(s) or the target can be
prefixed by either 'user at host:' or 'host:' .  User defaults to $USER
or $LOGNAME.  Multiple source files (on possibly multiple hosts) can be
specified as with cp(1), but better have unique file.ext names if from
multiple dirs or hosts (as with cp(1)). If the target isn't an existing
directory, it's taken as the filename (as with cp(1)), so it's safer
to say
 $ scp file     user at host:/directory/on/other/machine/.
or
 $ scp file     user at host:/directory/on/other/machine/file
to avoid surprises.

> If you don't put the users it will default to using the user you are on 
> the local machine but will ask you for the password.  

If you have a default identity in ~/.ssh on the local host and that default
identity  is in the remote host:~/.ssh/authorized_keys (or
~/.ssh/authorized_keys2) scp like ssh will not prompt for remote
password. It may prompt for passphrase for your local private key,
if ssh-agent hasn't already unlocked it and if the identity isn't
passphrase-free (normal for BatchMode but not for use in untrusted
environments or with portable devices!)

> If you don't 
> transfer certain files as the correct user, then permissions are not 
> correctly set.  

As previously stated, SETUID and SETGID (u+s, g+s) on the directory controls
the UID and GID of new files. On Linux, Solaris, VMS, and WinNT/XP, the
POSIX ACEs (Access Control Elements) implementation of Access Control
Lists (ACLs) can specify default permissions for new files in a
directory. (AIX and probably other early adopters of CMW ACLs lack
this, alas.)

> I would say the .profile(s) are read and used.

Easily verified by adding "echo PROFILE" to your .profile or .cshrc
as appropriate -- yes.  

So, SCP gets you (777 minus profile:umask) unless you use scp -p.

-- 
/"\     Bill Ricker  N1VUX  wdr at world.std.com
\ /     http://world.std.com/~wdr/           
 X      Member of the ASCII Ribbon Campaign Against HTML Mail
/ \



More information about the gnhlug-discuss mailing list