Posted on 2011-10-03
Last Modified: 2013-12-06
Hello Wanna know how to give  permission to change files in linux?
Cause I wanna copy some executables to a folder but it says I cannot cause I dont have the permissions.

Question by:GiorgioCarlos
    LVL 14

    Expert Comment

    Permissions have to be given by a user that can change permissions on files or folder, or who can change group memberships.

    Te commands to change permissions on files or folders are chmod and chown.

    Chown changes the ownership of a file. The command `chown user1 example` changes the owner of the file 'example' to user1, and the group to user1's default group. The command `chown user1:wheel example` does the same to the ownership, but the group is set to wheel.

    Chmod changes the permission bits of a file. Every file has 3 permission switches for 3 groups: u (user owner), g (group owner) and o (others), can independently allowed r (read access), w (write access) and/or x (execute access). The command chmod requires the parameters either in a form that specifies the user and the permissions or permission changes (like u+x, o-rwx) or as an octal number that is a bitfiels of the permission bits with the values r=4, w=2 and x=1 (ie. rwx = 4+2+1 => 7, chmod needs one digit for each group, eg. 644). The command `chmod u+rw example` would allow the user owner (the one you set with the chown command) read and write access. The command `chmod go-x example` would disallow execution of the file example by any group members of the owning group, as well as anyone else. The execute permission of the user owner is untouched. The command `chmod 755 example`would give the user owner read, write and execute permissions, the group owner and everyone else only read and execute.

    Depending on your filesystem, your linux might offer other ways of setting permissions. There might be tools that set ACLs. Common unix tools are the ones I described. Please also consult the man pages (type `man chmod` and `man chown`).

    LVL 31

    Expert Comment

    You need to change permissions on the target folder.  You need to have write and execute permissions on the target folder (where you would like the files to be copied).

    first see who owns it.

    ls -ld /path/to/folder

    Then you can change ownership by
    chown user:group folder

    Change the permissions
    chmod 777 target_folder

    Author Comment

    ok thanks , I wanna change a system file permissions

    chmod 777 usr/share/java :   it appears me that the file does not exist
    LVL 31

    Expert Comment


    chmod 777 /usr/share/java

    Author Comment

    LVL 31

    Accepted Solution

    You are most welcome

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Suggested Solutions

    In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
    The purpose of this article is to show how we can create Linux Mint virtual machine using Oracle Virtual Box. To install Linux Mint we have to download the ISO file from its website i.e. Once you open the link you will see …
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now