Jump to content


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.


Changing File Permissions

  • Please log in to reply
2 replies to this topic

#1 DnDer


  • Members
  • 646 posts
  • Local time:02:21 AM

Posted 05 February 2009 - 02:46 PM

Yes, it's also homework.

I have a file, File1, sitting in a directory. Default permissions are -rw-r---w-, if I remember right. My teacher wants to see it turned to -rw-r-----: read/write for the owner, read only for group, and none for the "all" category.

My thought was "chmod a-w g+r o+rw /root/file1." Because I learned that when you take off write from all, it removes it on owner. So place it first, remove it first, and then add permissions as you like. Didn't work.

My prof recommended using "touch" but I did a man touch, and it doesn't seem to do what he was describing. What am I looking for to do this in one line?

BC AdBot (Login to Remove)


#2 Andrew


    Bleepin' Night Watchman

  • Moderator
  • 8,260 posts
  • Gender:Not Telling
  • Location:Right behind you
  • Local time:12:21 AM

Posted 05 February 2009 - 06:25 PM

Hmmm... if it were me doing it, I'd probably use the octal representations for permissions (it's just easier for me to remember.)

chmod 640 File1

I'm not sure if that's what your teacher wants, but it gets the job done!

Good chmod tutorial:

#3 raw


    Bleeping Hacker

  • Members
  • 2,577 posts
  • Gender:Male
  • Location:Texas
  • Local time:02:21 AM

Posted 05 February 2009 - 08:54 PM

Like Andrew I also use octals for permissions.
I can remember chmod 640 File1 easier. (740 for executables)
touch File2 will create an empty file if it does not exist. If File2
does exist it will just update the time stamp.


 rawcreations.net          @raw_creations

Current systems: WHAT OS, BackTrack-raw, PCLinuxOS, Peppermint OS 6, Kali Linux

and a custom Linux From Scratch server hosting a bunch of top secret stuff.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users