LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-17-2012, 07:06 PM   #1
Whatif
Member
 
Registered: Nov 2010
Distribution: VectorLinux
Posts: 87

Rep: Reputation: 0
permission denied


Hello,

I'm trying to move the tomcat docs tar I downloaded but keep getting the following error:

mv apache-tomcat-7.0.32-fulldocs.tar.gz /software

mv: cannot create regular file '/software/apache-tomcat-7.0.32-fulldocs.tar.gz' : permission denied.

What can I do?

Thanks in advance,
Mike
 
Old 10-17-2012, 07:08 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,411

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
Well, as it says, you don't have permission.
You need to check the ownerships and perms of that dir and compare to your current user.
 
Old 10-17-2012, 07:27 PM   #3
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Brisbane, Australia
Distribution: pclinuxos slackware64 tails kali
Posts: 3,372
Blog Entries: 33

Rep: Reputation: 217Reputation: 217Reputation: 217
Hi, when you do this,
Quote:
mv apache-tomcat-7.0.32-fulldocs.tar.gz /software
you use an absolute address, that is copy/move to /software

You might try to put it in the /home/$USER/software by leaving out the /
(relative addressing, from where you are, like /home/$USER/)

type this,
Code:
mv apache-tomcat-7.0.32-fulldocs.tar.gz software
or
mv apache-tomcat-7.0.32-fulldocs.tar.gz ~/software
Most times a $USER may not write to any file/directory folder outside of /home/$USER/

Regards, Glenn
 
Old 10-17-2012, 10:05 PM   #4
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mageia, and whatever VMs I happen to be playing with
Posts: 12,788
Blog Entries: 17

Rep: Reputation: 3316Reputation: 3316Reputation: 3316Reputation: 3316Reputation: 3316Reputation: 3316Reputation: 3316Reputation: 3316Reputation: 3316Reputation: 3316Reputation: 3316
This command will tell you the permissions of the tarball:

Code:
ls -l apache-tomcat-7.0.32-fulldocs.tar.gz
This command

Code:
ls -l /software
will tell you the permission on the software directory (You should use the full path to the directory).

This will give you a good introduction to permissions: http://www.slackbook.org/html/book.h...RE-PERMISSIONS
 
Old 10-17-2012, 11:12 PM   #5
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
First of all make sure that /software directory exists. If it exists, then check permission and ownnership of both tar file as well as /software dir. as follow:
Quote:
ls -l apache-tomcat-7.0.32-fulldocs.tar.gz
ls -ld /software


If any one of them is owned by root or any other user or if do not have "write" permission for group and others, then it will not permit you to do so.
So switch to "root" user and invoke the mv command, and also use absolute paths, not relative paths. It will sure work.
Code:
# mv ./apache-tomcat-7.0.32-fulldocs.tar.gz /software/

Last edited by shivaa; 10-17-2012 at 11:15 PM.
 
Old 10-18-2012, 10:11 AM   #6
Whatif
Member
 
Registered: Nov 2010
Distribution: VectorLinux
Posts: 87

Original Poster
Rep: Reputation: 0
I logged in as root and the mv command worked. The output from the ls -l command for the /software is

drwx------ 2 root root 16384 Oct 16 16:58 lost+found/

and for the file I was tring to move is

-rw-r--r-- 1 mike mike 4906088 Oct 17 12:15 apache-tomcat-7.0.32-fulldocs.tar.gz

Is the problem with the /software since it doesn't have world write permission?

/software is the mount point for /dev/sda5 and I used the mount /dev/sda5 /software command to mount it since it's not in the /etc/fstab

I'm searching online to find out how to modify the /etc/fstab file but if the problem with the /software, can I modify the permissions with the mount command?

Thank you,
Mike
 
Old 10-18-2012, 12:33 PM   #7
User\ Name=`echo $USER`
LQ Newbie
 
Registered: Oct 2012
Location: Oklahoma
Distribution: Red Hat, Ubuntu, Mac OS X
Posts: 25

Rep: Reputation: 4
If I understand the problem you're having correctly, have you tried

Code:
sudo chmod 664 (filename)
?

Last edited by User\ Name=`echo $USER`; 10-18-2012 at 12:35 PM.
 
Old 10-18-2012, 01:04 PM   #8
mandyapenguin
Member
 
Registered: Nov 2011
Location: India
Distribution: RedHat, Cent OS, Fedora, Debian, Ubuntu
Posts: 106

Rep: Reputation: Disabled
Quote:
mv apache-tomcat-7.0.32-fulldocs.tar.gz /software

mv: cannot create regular file '/software/apache-tomcat-7.0.32-fulldocs.tar.gz' : permission denied.

What can I do?

Thanks in advance,
You can set permissions to particular user using Access Control List., Just see the below examples
Code:
# ls -ld /software/
drwxr-xr-x 2 root root 4096 Oct 18 22:08 /software/
As you can see user has full permission(rwx) to /software folder, group and others having only read and excecute permission

Code:
# getfacl /software/
getfacl: Removing leading '/' from absolute path names
# file: software/
# owner: root
# group: root
user::rwx
group::r-x
other::r-x
Just try to create file as "Whatif" user
Code:
# su Whatif
$ cd /software/
$ touch Whatif
touch: cannot touch `Whatif': Permission denied

$ exit
exit
Give full permission to only "Whatif" user to /software folder.
Code:
# setfacl -R -m u:Whatif:rwx /software/

# echo $?
0

# getfacl /software/
getfacl: Removing leading '/' from absolute path names
# file: software/
# owner: root
# group: root
user::rwx
user:Whatif:rwx
group::r-x
mask::rwx
other::r-x

# su Whatif
$ cd /software/
$ touch Whatif
$ ls -ltrh
total 0
-rw-rw-r-- 1 Whatif Whatif 0 Oct 18 22:09 Whatif
 
Old 10-18-2012, 02:56 PM   #9
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Quote:
Originally Posted by Whatif View Post
I logged in as root and the mv command worked. The output from the ls -l command for the /software is

drwx------ 2 root root 16384 Oct 16 16:58 lost+found/

and for the file I was tring to move is

-rw-r--r-- 1 mike mike 4906088 Oct 17 12:15 apache-tomcat-7.0.32-fulldocs.tar.gz

Is the problem with the /software since it doesn't have world write permission?

/software is the mount point for /dev/sda5 and I used the mount /dev/sda5 /software command to mount it since it's not in the /etc/fstab

I'm searching online to find out how to modify the /etc/fstab file but if the problem with the /software, can I modify the permissions with the mount command?

Thank you,
Mike
Mike, there's nothing tricky in your problem. It was simply because you were trying to move something in a directory which was write protected.
Well, there are following ways now:
First way# Add write permissions for /software directory for group and other, so you will be able to move anything from/to it, as follow:
# su - root
Enter root password:

(I assume that you know the root password, else use command # sudo su - root)
# chmod 777 /software

Second way# You can change ownership and group of the directory, so it will then allow you, as follow (again do it as root only):
# chown mike:mike /software
# ls -ld /software
drwxrwxrwx 2 root root 16384 Oct 16 16:58 /software
(Output would be something like this, though you've mentioned wrong output of lost+fond file instead of /software in your last comment. So take a note that always use ls -ld not just ls -l, as ls -l will give you content inside the dir.)

Third way# Instead of changing permissions or ownership, just change group of the /software dir. and add yourself in that group and then add "write" permission for group on it, as follow:
# chgrp mike /software (Or you can specify any other group in place of mike)
# chmod 770 /software

Last edited by shivaa; 10-18-2012 at 02:58 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mkdir throws Permission Denied error in a directoy even with root ownership and 777 permission surajchalukya Linux - Security 14 09-03-2012 09:34 AM
can't execute c++ binaries, "permission denied"... even though permission is 777 SerfurJ Programming 14 02-20-2009 05:50 AM
'permission denied" inspite of right permission flags on network drive anirudhvij Linux - Enterprise 8 05-22-2007 06:57 AM
Permission Denied Deag^ Linux - Newbie 2 10-20-2004 03:14 PM
Permission Denied Viper Slackware 7 08-07-2002 09:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration