Operating System - HP-UX
1836633 Members
1892 Online
110102 Solutions
New Discussion

Changing file permissions

 
SOLVED
Go to solution
Carla Breuer
Frequent Advisor

Changing file permissions

Hello All!
I have a very simple request for a sysadmin. I need to change the permission on a file form -rw-r--r-- to -rwxrwxrwx. I read the man pages on chmod and came up with:

sys000#chmod a+x myfile

Is this correct? I am running HPUX 11.0

Thanx,

Carla
10 REPLIES 10
Patrick Wallek
Honored Contributor
Solution

Re: Changing file permissions

I always use the numeric syntax for permissions. To change a file to -rwxrwxrwx you would use the following:

# chmod 777 myfile

You get the 777 by:

4=read permission
2=write permission
1=execute permission

Add them together and you get 7, so 777 for owner, group and world users.

Make sense?
Pete Randall
Outstanding Contributor

Re: Changing file permissions

Actually you would need chmod a+wx or chmod 777 to do what you desire.


Pete

Pete
Tom Maloy
Respected Contributor

Re: Changing file permissions

Not correct. Adding just x permission will result in -rwxr-xr-x. You could use

chmod a+wx myfile

to cover both write and execute permission.
Carpe diem!
Paul Sperry
Honored Contributor

Re: Changing file permissions

chmod 777 file

or

chmod ugo+r+w+x file
Dario_1
Trusted Contributor

Re: Changing file permissions

Carla:

I will use

chmod 777 filename

Regards,

DR
Bill Hassell
Honored Contributor

Re: Changing file permissions

BIG RED FLAG: Why do you need rwxrwxrwx permissions? This is a very typical begginer's error when some message like permission denied shows up. The rwx permission for everyone means that this file is a script or interpreted language file (is it?) because data files should never be executable! And the w in the last rwx triplet means that the contents are worthless! Read that twice! By allowing the file to be writable by anyone on the system to destroy the contents of the file.

Far too often, Unix for Beginners books and courses will blindly tell newbies that 777 (or rwxrwxrwx) permissions solve problems, when just the opposite is true. Never allow any important file to be writable for eveeryone on the system.


Bill Hassell, sysadmin
Carla Breuer
Frequent Advisor

Re: Changing file permissions

This is a print driver I am setting up in my newly arrived L1000 aka rp5400. I looked at the print driver in the production system and the driver has the permissions I was asking for above. I just went into vi and created this one in the new machine and need it to have the same permissions. I am playing with my new machine. The guys setting up my system didn't copy any of the drivers over and few other pieces I need to get printing. I am finding all the pieces they missed. It's a lot of fun! Hopefully Bill will put the red flag away now. LOL

I will be assigning points to all shortly!

Thanx,

Carla

Kelli Ward
Trusted Contributor

Re: Changing file permissions

Correct me if I'm wrong, but isn't 666 permisions -rw-rw-rw- sufficient?
Just curious,
Kel
The more I learn, the more I realize how much more I have to learn. Isn't it GREAT!
Carla Breuer
Frequent Advisor

Re: Changing file permissions

Thank you all so very much! I am printing on the new machine. YEAH!!! Kelly, my machine gave me an error stating that the print driver must have executable permissions. After changing the permissions to 777 (to match the production server) all is well. I do have other drivers with different permissions on them, but they all have executable for all in the permissions. I guess we need a new thread to find out what are the least amount of permissions to give to a print driver???
Patrick Wallek
Honored Contributor

Re: Changing file permissions

I would try permissions of 555 or 755 on the print driver. There should be no reason that anyone would need to write to it.

# chmod 555 filename

would give -r-xr-xr-x permission

# chmod 755 filename

would give -rwxr-xr-x permissions