Can't run mkdir even as root please help

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Can't run mkdir even as root please help
# 1  
Old 05-02-2013
Can't run mkdir even as root please help

I cannot mkdir as root
please see below

Code:
[root@vm1 ~]# mkdir /home/vm1/Desktop/nfs
mkdir: cannot create directory `/home/vm1/Desktop/nfs': Permission denied

so i checked the selinux context below and got

Code:
[root@vm1 ~]# ls -Z /home/vm1
drwxrwxrwx. root root system_u:object_r:autofs_t:s0    Desktop
drwxr-xr-x. vm1  vm1  unconfined_u:object_r:user_home_t:s0 Documents
drwxr-xr-x. vm1  vm1  unconfined_u:object_r:user_home_t:s0 Downloads
drwxr-xr-x. vm1  vm1  unconfined_u:object_r:audio_home_t:s0 Music
drwxr-xr-x. vm1  vm1  unconfined_u:object_r:user_home_t:s0 Pictures
drwxr-xr-x. vm1  vm1  unconfined_u:object_r:user_home_t:s0 Public
drwxr-xr-x. vm1  vm1  unconfined_u:object_r:user_home_t:s0 Templates
drwxr-xr-x. vm1  vm1  unconfined_u:object_r:user_home_t:s0 Videos

Can someone tell me what is wrong here?
And yes i was trying to mount nfs using autofs at some point and wasn't running so seeing autofs there is confusing me..maybe it caused a problem somewhere...


also after the autofs problem i noticed the whole folders and files in /home/vm1/Desktop are all gone.

Please what happened?

Thanks

Last edited by radoulov; 05-02-2013 at 05:29 PM.. Reason: Code tags fixed: icode to code
# 2  
Old 05-02-2013
Is that sn NFS or a local filesystem? What options did you use to mount it? Maybe there's an ACL in the way?
# 3  
Old 05-02-2013
Quote:
Originally Posted by verdepollo
Is that sn NFS or a local filesystem? What options did you use to mount it? Maybe there's an ACL in the way?
No there is no acl...what i tried before was to mount NFS and also to mount the NFS using automounter and if you look at the error from the opening thread...you will see autofs in the context for the Desktop dir


See below
Code:
[root@vm1 ~]# mount
/dev/mapper/vg_sda2-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)


This is the options i used to mount NFS
Code:
[root@vm1 ~]# mount -vvv -o 'vers=3' 192.168.1.34:/home/vm1/Desktop/nfs /home/vm1/Desktop/nfs-mount

Also check How to mount NFS using automounter(autofs)? to see problems i faces mounting automounter

Last edited by radoulov; 05-02-2013 at 05:29 PM..
# 4  
Old 05-02-2013
Root is especially prohibited from modifying remote NFS in my experience, since it's not "your" filesystem; since it's on some other machine, you only get the permissions its been told to allow you.
# 5  
Old 05-02-2013
Quote:
Originally Posted by Corona688
Root is especially prohibited from modifying remote NFS in my experience, since it's not "your" filesystem; since it's on some other machine, you only get the permissions its been told to allow you.
So i am guessing that is what the problem is then because i have been running as root ever since...but then my question is why did it mount? Why can't linux not mount and tell me "you can't mount as root"? Why can't i get that type of error message?

That is just my problem with software nowadays...with all logs everywhere and error messages yet the simplest thing to log it won't like just simply telling one exactly what is wrong

I have a question though...so how do i know what user to mount as?
What if i was mounting on a mount point that is not user related?

Last edited by nokia3310; 05-02-2013 at 04:19 PM..
# 6  
Old 05-02-2013
Who gets to mount a filesystem isn't necessarily the same as who gets to access it. Imagine a filesystem in /etc/fstab with 'user' in its properties, which allows a non-root user to go mount /path/to/filesystem ... but once they do so, whether they can access it or not depends on its file permissions, not who mounted it.

Root doesn't get access to a filesystem because it mounted it... it gets access because it's root, and has access to everything local no matter what. (Using root all the time is an extremely bad idea, by the way.)

NFS mounts are profoundly not your machine. You don't have their root, you have a root, which they aren't necessarily forced to trust. Once you mount it, who actually gets to access the files depends on what the file permissions are and what the NFS server is configured to do.

It's telling you "permission denied" because the NFS server is denying you permission... It's not really keeping secrets from you. Try accessing it from the owners of those files.

Last edited by Corona688; 05-02-2013 at 04:25 PM..
# 7  
Old 05-02-2013
Quote:
Originally Posted by nokia3310
I have a question though...so how do i know what user to mount as?
Usually you do all mounting as root since mount needs elevated permissions.

The ownership of the files and folders inside a mountpoint has nothing to do with who mounts it however. It depends on the file's owners, the folder's owners, and the rwx flags. You're just used to root plowing through all permissions barriers, and hit a rare situation where it doesn't.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to run a bash script that logs on as a non-root user and runs script as root

So I have a script that runs as a non-root user, lets say the username is 'xymon' . This script needs to log on to a remote system as a non-root user also and call up a bash script that runs another bash script as root. in short: user xymon on system A needs to run a file as root user and have... (2 Replies)
Discussion started by: damang111
2 Replies

2. UNIX for Dummies Questions & Answers

Exposure to run JVM under root?

We noticed that a JMS application running on a WebSphere application Server (not inside the J2EE container) is trying to access some resources using the UserId root. We checked with the developers, they said they did not specify any userId and it may be WAS is assigning the userId running the JVM... (2 Replies)
Discussion started by: AIX_user
2 Replies

3. Cybersecurity

Run chage as not root ?

Hello, Running Debian lenny. Is there any way to run $ chage --expiredate some_date user1 chage: Permission denied. as not root user inside script ? I really need to do this, I could grant whatever group membership to running user, setuid bit or whatever is needed ? (I do not want to do... (4 Replies)
Discussion started by: vilius
4 Replies

4. Shell Programming and Scripting

How to run Route in bash without as root

Hi friends, I will make a bash script for excecuted a route (My OS is Ubuntu 10.04) this is my script (with name mine.sh) #!/bin/bash route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.1 if I run this bash as root, i can run it.. root@venom-desktop:/home/venom#sh... (2 Replies)
Discussion started by: venom
2 Replies

5. UNIX for Dummies Questions & Answers

How to allow access to some commands having root privleges to be run bu non root user

hi i am new to unix and i have abig task. i have to \run particular commands having root privileges from a non root user. i know sudo is one of the way but i need sum other approach kindly help Thanks (5 Replies)
Discussion started by: suryashikha
5 Replies

6. Shell Programming and Scripting

how to run a command as root

Hi, i need to run a command as root.Whoever executes the command ,i will check for a particular role if that is satisfied i have to make it to run as root. Please help me to carry out this. Thanks Padmini (1 Reply)
Discussion started by: padmisri
1 Replies

7. AIX

Crontab cannot run by non-root user

Good morning everybody. I have just receiedv a complaint from our DBA saying that if he create a scripts to run some Oracle performance scripts using crontab and the scheduling part is ok but the job is failed when I checked on /var/adm/cron/log. I have tried his scripts using Oracle id directly... (4 Replies)
Discussion started by: kwliew999
4 Replies

8. Shell Programming and Scripting

Make program only run by root

Hi all, i hope i got this in the right place, what i am trying to do is make a program only run by root, ie for instance user fred is logged in and uses firefox, what id like to do is change that so that when fred wants to use firefox he will be asked to enter root password before he is allowed to... (14 Replies)
Discussion started by: dave123
14 Replies

9. Filesystems, Disks and Memory

RUN OUT SPACE (Root)

Dear Buddies, Plz Help me out ,,,,,, the Unix Servers i m working on ,,,Somes times run out of space in root ,,,due the generation of a file named STA ....which causes the system to crash ,,,,, plz hlp me !!!!!!!!!!!!!!!!!!!!!! how to find out the file ....generation causes ...... ... (6 Replies)
Discussion started by: scorpiyanz
6 Replies

10. UNIX for Dummies Questions & Answers

Run non-root script as root with non-root environment

All, I want to run a non-root script as the root user with non-root environment variables with crontab. The non-root user would have environment variables for database access such as Oracle or Sybase. The root user does not have the Oracle or Sybase enviroment variables. I thought you could do... (2 Replies)
Discussion started by: bubba112557
2 Replies
Login or Register to Ask a Question