Operating System - HP-UX
1753774 Members
7347 Online
108799 Solutions
New Discussion юеВ

Re: Release file permissions

 
SOLVED
Go to solution
peterchu
Super Advisor

Release file permissions

I want to release a file to all users to read , the file is under /var , but the permission not let them to access /var ( default) , how can I remain the permission of /var , but users can read the file under /var ? thx.
5 REPLIES 5
Steven E. Protter
Exalted Contributor
Solution

Re: Release file permissions

cd /var
chmod -R a+r *

everybody can read

chmod a-r /var

default permission of /var itself not readable.

Might not want to do this to a production machine. I'm not sure your wish is very system friendly.

Regards and felicitations,

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Dexter Filmore
Honored Contributor

Re: Release file permissions

In the /var directory:

chmod a+r file
Nguyen Anh Tien
Honored Contributor

Re: Release file permissions

chmod command has some option, you can check by man page
#man chmod
chmod u Modify permissions for user (owner).
g Modify permissions for group.
o Modify permissions for others.
a Modify permissions for all users (a is equivalent to ugo).
so you can correct by
#chmod a+r /var
HP is simple
Hoang Chi Cong_1
Honored Contributor

Re: Release file permissions

Hi peterchu

One more way:
#chmod 444

It works!

Best and regard,

HoangChiCong
Looking for a special chance.......
Bill Hassell
Honored Contributor

Re: Release file permissions

/var permission MUST be 755 which gives no permission to remove files or create directories in /var. Now there is a big difference between 'access /var' and change the contents of /var. If you remove 'access' rights (cd /var, ls /var, etc) then *everything in your system will break since /var is a mandatory directory for most programs. All users must be able to list the contents of /var.

Now if you mean /var/tmp, that is a separate directory and it's permission must be 755 or 1755. The way that permissions work is that the directory gives 'visibility' to files inside the directory. If a directory is 700, then no one except the owner of the directory can cd into the directory or list (ls) the contents. Whether a user can 'see' the file is under the directory's control but whether a user can read the contents of a file is controlled by the file's permission. Change the file to 444 permission and now every user can read (but not change) the file's contents.


Bill Hassell, sysadmin