Avatar of GiorgioCarlos
GiorgioCarlosFlag for Italy

asked on 

linux

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.

Linux Distributions

Avatar of undefined
Last Comment
farzanj
Avatar of svgmuc
svgmuc
Flag of United States of America image

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`).

HTH
Avatar of farzanj
farzanj
Flag of Canada image

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
Avatar of GiorgioCarlos
GiorgioCarlos
Flag of Italy image

ASKER

ok thanks , I wanna change a system file permissions

chmod 777 usr/share/java :   it appears me that the file does not exist
Avatar of farzanj
farzanj
Flag of Canada image

Try:

chmod 777 /usr/share/java
Avatar of GiorgioCarlos
GiorgioCarlos
Flag of Italy image

ASKER

thanks
ASKER CERTIFIED SOLUTION
Avatar of farzanj
farzanj
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Linux Distributions
Linux Distributions

A Linux distribution is an operating system made as a software collection based on the Linux kernel and, often, on a package management system and are available for a variety of systems. A typical Linux distribution comprises a Linux kernel, GNU tools and libraries, additional software, documentation, a window system (the most common being the X Window System), a window manager, and a desktop environment. Most Linux systems are open-source software made available both as compiled binaries and in source code form, allowing modifications to the original software. Over three hundred distributions are in active development, including commercially backed distributions (such as Fedora, openSUSE and Ubuntu) and community-driven distributions (such as Debian, Slackware, Gentoo and Arch Linux).

29K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo