Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium



Posted on 2011-10-03
Medium Priority
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
  • 3
  • 2
LVL 14

Expert Comment

ID: 36907864
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

ID: 36909376
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

ID: 36909467
ok thanks , I wanna change a system file permissions

chmod 777 usr/share/java :   it appears me that the file does not exist
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 31

Expert Comment

ID: 36909523

chmod 777 /usr/share/java

Author Comment

ID: 36909652
LVL 31

Accepted Solution

farzanj earned 2000 total points
ID: 36909697
You are most welcome

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating a Samba server for a small office. Ubuntu Linux and Samba can breathe new life into a retired PC and save an office money on new hardware/software. Our example server will have two hard disks, one exclusively for storing shared data. …
You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

571 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