LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to solve problems with permissions? (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-solve-problems-with-permissions-590729/)

tuffsach 10-10-2007 03:47 AM

how to solve problems with permissions?
 
im getting a message like:
sachin@sachin-desktop:~/Desktop/rar$ cp unrar /usr/local/bin
cp: cannot create regular file `/usr/local/bin/unrar': Permission denied


i do not know wat this means and don't know to what to do abt it .if i could get some help?

colucix 10-10-2007 04:02 AM

In Linux files have ownership and permissions: the ownership is "to whom the file belongs", permissions are "who can read, write or execute files". In this case you are trying to write a file in a directory which most likely belong to root. You may verify this by issuing
Code:

ls -ld /usr/local
drwxr-xr-x 33 root root 4096 Jan 10  2007 /usr/local/

So to move or copy a file to /usr/local/bin you have to be root or have root privileges (by the sudo command). For details you can see
Code:

man chown
man chmod
man sudo


carl0ski 10-10-2007 04:50 AM

Quote:

Originally Posted by tuffsach (Post 2919380)
im getting a message like:
sachin@sachin-desktop:~/Desktop/rar$ cp unrar /usr/local/bin
cp: cannot create regular file `/usr/local/bin/unrar': Permission denied


i do not know wat this means and don't know to what to do abt it .if i could get some help?

Like windows only a high level user may modify files in system directories.

Windows most of c:\ and Windows folders are restricted.
only Documents and Settings\username is open to full access

Linux is the same
c:\ is replace by / (root)
Documents and Settings\username is replaced by /home/username
and the subfolders of /media /mnt are also usually user accessible.

I dont suggest granting your self full access to any bar the default folders. since this command is a very rare occurance.

to copy this file you should use a user with root permission

it you use Ubuntu or Debian
sudo cp unrar /usr/local/bin
Password: <your sachin password>

any other Distro
sachin@sachin-desktop:~/Desktop/rar$ su
Password: <your root password>
root@sachin-desktop:~/Desktop/rar#cp unrar /usr/local/bin


All times are GMT -5. The time now is 09:17 AM.