Thread: Chmod

    #1
  1. No Profile Picture
    Sencha Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    STL
    Posts
    547
    Rep Power
    0

    Chmod


    I tried looking at FreeBSD's page and a few others. I tried to do man chmod. I still cannot get how to change the permission...
    -Mitchell Simoens
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2001
    Posts
    174
    Rep Power
    18
    chmod can change permissions of a file or directory
    you could set rwx read,write,execute for users,group,and misc

    chmod -R 777 mydir (will set it to rwx by world(all)
    -R recursive
    you probably don't want to set anything 777
  4. #3
  5. No Profile Picture
    Sencha Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    STL
    Posts
    547
    Rep Power
    0
    I did that and it says Operation Not Permitted... do I need to be logged in as the superuser? How to I switch to the superuser?
    -Mitchell Simoens
  6. #4
  7. No Profile Picture
    Sencha Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    STL
    Posts
    547
    Rep Power
    0
    I tried to edit rc.conf using ee but when I went to save it, it says unable to create file "/etc/rc.conf". Is this because of superuser or CHMOD?
    -Mitchell Simoens
  8. #5
  9. No Profile Picture
    Slacker
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2001
    Location
    Sweden
    Posts
    76
    Rep Power
    14
    Do you have the right to change filepermissions on the file you are trying to change? Probably not. Do an ls -l to see the filepermissions. You read left to right: Owners permissions (the one who created the file), Group permissions and then the others permissions.

    So, you might see something like this:
    Code:
    -rw-r--r--    1 erik   users         128 Jun  6  2000 welcome.msg
    Wich means, erik (the owner) has read and write permission to this file. The group users have the right to read the document, and the others have allso read permissions.
    To illustrate: 'chmod o+r filename' give others (everyone) read permissions. 'chmod g-r filename' remove read permissions for the group, and finally 'chmod u+rwx filename' give the owner the right to read, write and execute the file. The operators + and - adds or takes away a permission. You can allso use = to make it the only setting. Say 'chmod u=rw,g=r filename' which would mean the setting will be user have rw and group has r and other have nothing, no matter what the rights where before the change

    So when BSD check to see if you have right to change, it first look, are you the owner for read and write permission? No. Then are you in the group for read permission? No. So does anyone that doesn't match these other permissions have the right to do anything with the file? Yes, everyone is allowed to read it. Then it shows it to you.
    Now, your file might have something like -rw-r----- and you don't own the file or are in the group to which the file belongs to. Then you are not allowed to change it (even if you are in the group you wouldn't get to change it scince you would still only have read permissions)

    Now, this chmod business (related commands: chown, chgrp) are the same on all unix systems, and as Bob Loblaw you can allso use numbers to set permissions. So do a search on altavista or whatever for chmod and you will find explinations on how to do all of this.

    After this throughout explination, I hope you have no more questions about chmod though

    Oh, I almost forgot. To change to superuser you just use su. I assume it's the same as on OpenBSD in which case you would need to add yourself to the wheelgroup to do this. Just login as root and edit /etc/groups and add username to the wheelgroup. Then logout and use su instead of logging in as root in the future!
    Type su and enter, it will ask for a password, give it your root pass and you are in as root. Now, when you are done just type exit to ascape to normal user.

    An even better solution would be to use sudo. This let you give a command as root without logging in as root (as you do with su).
    Don't know if this comes with FreeBSD, but if it don't it should be somewhere in the ports tree. Install it, read the manual, it has the instructions you need to know and you should be on your way.

    /Fjodor
    Last edited by Fjodor; January 13th, 2002 at 10:05 AM.

IMN logo majestic logo threadwatch logo seochat tools logo