Operating System - HP-UX
1834149 Members
2807 Online
110064 Solutions
New Discussion

About the file permission

 
SOLVED
Go to solution
peterchu
Super Advisor

About the file permission

there is a directory eg. /usr/local/bin , all the files under this directory :
1. the file and directory owner is user1:edp ,
2. the permission is 644

I want everyone hv permission to overwrite all files and write a new file to it , but I want the file owner and permssion keep unchange , could suggest what can I do ? thx
13 REPLIES 13
Devender Khatana
Honored Contributor
Solution

Re: About the file permission

Hi,

For files which need to be overwritten by everybody set mode with write permissions to all. But /usr/local/bin is generally used for local executables which means you should also provide executable permissions. This means your will have to specify rwx permissions for all users. This I think is not a good practice as only useres who creates file should have right permissions to these and everydody else should have only execute permissions.

Set permission on directory to 777 for other them users in bin group to be able to create files in the directory.

The permissions for new files will of the user:group who creates them and it can not be avoided.

HTH,
Devender
Impossible itself mentions "I m possible"
Darrel Louis
Honored Contributor

Re: About the file permission

Hi,

Why should everyone be able to write files in /usr/local/bin, this is mostly included in your PATH variable, high security risk.
So everyone who logs in can execute everything located in this directory, even a Hacker.

Permissions on files are set based on your umask setting.

Files created by a specific user will always be the owner.

What kind of files you want to put under this directory?

GoodLuck

Darrel
peterchu
Super Advisor

Re: About the file permission

thx replies,

I only take the path /usr/local/bin as a example , actually I still not decide which path will this common files will put to , possibly put on /home/user1 path . thx
Muthukumar_5
Honored Contributor

Re: About the file permission

If you want to give permission for overwrite and writing a new file you can change only the permission as,

for file in `find /path -name "*"`
do
chmod 666 $file
done

666 - It can be readable and writable.

But the execution of this script will need proper permission of file owner and group.

HTH.
Easy to suggest when don't know about the problem!
Amit Agarwal_1
Trusted Contributor

Re: About the file permission

you can use the ACL (access control list) feature. But you will need to make entry for each user. See 'man setacl' and 'man getacl'.

-Amit
peterchu
Super Advisor

Re: About the file permission

thx replies, I don't want to change to 666 , if I want to keep 644 , what can I do ?
I have about 70 users , setacl seems not suit our case , could you have other advise ? thx.
peterchu
Super Advisor

Re: About the file permission

I hv one suggestion but not sure whether it will work , I know the password of user1:edp , when the user cp the file to it , it su to this userid then overwrite the file , is it work ? thx
Darrel Louis
Honored Contributor

Re: About the file permission

Hi,

What's your umask set to?
# umask

The umask value is set within /etc/profile.

man umask.

Darrel


john korterman
Honored Contributor

Re: About the file permission

Hi,
I can think of only one method, which I even myself find a bit too creative...

Let ftp deliver the files: the restricted version of ftp, which makes use of ftpaccess, allows defining the destination directory and access and overwrite rights for files delivered there.
This assumes that your users deliver the files by ftping them to the server; in this case they would have to use a common ftp-user.
However, perhaps you should reconsider the whole design: is it not a problem not to know when a file is replaced?

regards,
John K.

it would be nice if you always got a second chance
Amit Agarwal_1
Trusted Contributor

Re: About the file permission

use 'rcp' or 'remsh'.
peterchu
Super Advisor

Re: About the file permission

thx suggestion,

Further to my suggestion , is it OK to su to the userid "user1" before copy the file ? as I know , the similiar command like below can su to another user before rcp file , but I try it but it is fail to run at localhost , could suggest is it possible ? thx


rcp file user1@remote_host:/home/user1

Amit Agarwal_1
Trusted Contributor

Re: About the file permission

Did you make the .rhosts entry.

In user1 home directory, create a file called .rhosts and add an entry for each user.

$ cat .rhosts
xyz user1
xyz user2
xyz user3

where xyz is the hostname. You can use '+' to allow user to login from any host.

I am not sure if 'su' would work or not.
peterchu
Super Advisor

Re: About the file permission

thx reply again,

I am wonder is there any method that before the user overwrite the file , it will automatically change to another userid ( eg. user1 ) , if so , I think it will totally solve my problem - no need to change file owner and permission , could advise is it possible ? thx