Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23

Thread: command: chmod

  1. #11
    Join Date
    Apr 2012
    Location
    San Rafael, CA USA
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Quote Originally Posted by gcawood View Post
    (ps, never set things to 777 unless you have a really good reason to do so.)
    Knowing chmod is very handy. It's second nature to me.

    The two most common values are

    755 - wide open for user, read and executable for everyone else
    644 - read and writable for user, readable by everyone else

    If you want to change one bit, use this variation:

    chmod u+x myfile

    This makes the file executable by the user who owns the file. There are variations of that too.

    chmod ug+x myfile (allow execute permission for user and group)
    chmod u+rwx myfile (allow read and write to user)
    chmod a-x myfile (disallow execute permission for all)

    u = user
    g = group
    o = other
    a = all

    r = read
    w = write
    x = execute

    '+' = allow permission
    '-' = disallow permission

    Sometimes using this syntax is easier than doing math. Have both techniques in your toolbox.

    -Bob
    Last edited by forestplay; 05-14-2012 at 12:07 PM. Reason: added more info




  2. #12
    Join Date
    Mar 2012
    Location
    Cardboard box
    Posts
    113
    Thanks
    2
    Thanked 4 Times in 4 Posts
    Rep Power
    2
    On top of it, one could append "1" to the three digits for sticky, e.g.: chmod 1777 some_file
    distrACT -- an open community

  3. #13
    Join Date
    May 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Hi,

    Can you actually explain what do you mean by " using CHMOD via SSH " ?

    If you are talking about logging into some other machine through SSH and then changing the permissions, can you please tell me , why do you find it unsafe to CHMOD using SSH? And also, can you tell me more about cPANEL?

  4. #14
    Join Date
    May 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    what does sticky actually mean?

  5. #15
    Join Date
    Mar 2012
    Location
    Cardboard box
    Posts
    113
    Thanks
    2
    Thanked 4 Times in 4 Posts
    Rep Power
    2
    Sticky means only owner can remove or rename the file or link.

    And after double checking to make sure, I realised that Linux does not recognise this use. So it is irrelevant to Linux. (I did not know this, so I also learnt something new. )
    distrACT -- an open community

  6. #16
    Join Date
    May 2012
    Posts
    27
    Thanks
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0
    I'm almost certain Linux machines can use the sticky bit; do you have a valid source that says otherwise?

  7. #17
    Join Date
    Mar 2012
    Location
    Cardboard box
    Posts
    113
    Thanks
    2
    Thanked 4 Times in 4 Posts
    Rep Power
    2
    Wikipedia. And on reading it again, it seems like I have misread. Go me on Monday.

    So it seems like Linux ignores the traditional function of sticky bit, whilst retaining its effect on renaming and deletion?

    I think this explanation from Happy Hacker Digests sums it up nicely.

    3. Re: t bit of chmod
    From: Christopher Hicks <chicks@chicks.net>

    On Fri, 4 Jul 1997, Meino Christian Cramer wrote:
    > I've been struggled over the "t" and "T" bit of the chmod-command.
    >
    > The man-pages said for the t-bit "save program text on swap device (t)"
    > (and what's about directories???)
    >
    > If I do a chmod 7552 I will get a "T" instead of "t" -- also no answer
    > from the man-pages.

    The t flag (a.k.a. the sticky bit) has an ancient purpose when applied to
    files which is mainly of historical amusement on modern machines. It also
    has a quite practical purpose when applied to directories.

    First, the amusement. Back in the days when UNIX ran on machines with 16k
    or less of RAM (!), it was a significant performance improvement to be
    able to keep some programs accessible more quickly. Widely used programs
    (such as vi) had their sticky bit set, so they'd 'stick' around. This
    meant that even if noone was using vi at the moment, it would at least
    stay in swap since swap was often a faster device and there's less
    computation to swap something in than to start it up from scratch. With
    modern OS's such as linux which dynamically allocate disk cache on
    machines with up to a gigabyte of RAM, there is little value to the
    sticky bit. For FILES, that is.

    But the sticky bit is not just an anachronism. When applied to
    directories it causes a quite valuable behaviour. It prevents people from
    deleting or moving files they don't own. You might think "but UNIX
    handles that anyway". Well, sort of. Deleting and renaming are dependant
    on the permissions of the DIRECTORY. Since everyone has their own home
    directory and has their own files in it, why would anyone care? Because
    of tmp directories. Tmp directories are world writable. This would
    normally allow anyone to delete or rename files in them -- whether they
    owned the file or not. But that would make temporary directories
    significantly less useful. So it was decided that the sticky bit would be
    'overloaded' with a special behaviour when it was set on directories.

    If you're interested in seeing all the sticky files and directories on
    your system, try
    find / -perm -1000 -ls
    (This may not work on some commercial systems that use non-gnu versions
    of find.)

    </chris>

    Free software isn't free, but expensive software is expensive
    ~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
    "Unix is hacker crack." -- Unix-Haters Handbook
    Sorry for the confusion.
    distrACT -- an open community

  8. #18
    Join Date
    May 2012
    Posts
    27
    Thanks
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0
    Ah, well that's significantly more correct-sounding. You learn something new every day, I suppose.

  9. #19
    Join Date
    May 2012
    Posts
    90
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    2
    Quote Originally Posted by dale View Post
    Wikipedia. And on reading it again, it seems like I have misread. Go me on Monday.

    So it seems like Linux ignores the traditional function of sticky bit, whilst retaining its effect on renaming and deletion?

    I think this explanation from Happy Hacker Digests sums it up nicely.



    Sorry for the confusion.
    Its not a problem ,now its much more clear .

  10. #20
    Join Date
    Apr 2012
    Posts
    45
    Thanks
    1
    Thanked 1 Time in 1 Post
    Rep Power
    0
    Quote Originally Posted by dale View Post
    Sticky means only owner can remove or rename the file or link.

    And after double checking to make sure, I realised that Linux does not recognise this use. So it is irrelevant to Linux. (I did not know this, so I also learnt something new. )
    I learn something new everyday on here.
    Thanks for explaining, because I certainly was lost.

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
           








Check out Linux Central for Linux software and other goodies!





» Stats

Members: 3,581
Threads: 3,920
Posts: 9,447
Top Poster: Fred (1,486)
Welcome to our newest member, AmyJoan

» Links



Powered by vBadvanced CMPS