Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want copy to /lib/udev but gives error

cp -f /tmp/ok_pcscd_hotplug.sh /lib/udev

cp:cannot create regular file /lib/udev/ok_pcscd_hotplug : Permission denied

I am root , but I can't understand . what can I do ?

share|improve this question
add comment

3 Answers 3

Check if you are really superuser with:

whoami

if the output is root, then you are superuser and you can make the copy of the file with:

cp -f /tmp/ok_pcscd_hotplug.sh /lib/udev/.

otherwise you have to use sudo:

sudo cp -f /tmp/ok_pcscd_hotplug.sh /lib/udev/.

If you're still not able to write to the directory, then it is possible that:

  1. the directory has the immutable flag enabled. check with lsattr.
  2. the directory is mounted with read-only permissions: type in terminal:

    cat /proc/mounts (or mount or cat /etc/mtab)

    and check the output, if directory is mounted read-only.

If you are in the first case, change the directory attributes with chattr;
If you're in the latter case, edit the file /etc/fstab.

share|improve this answer
    
whoami - output root i tried cp -f and sudo cp -f , but gives error again –  user278122 May 7 at 11:47
    
I made ​​a small change to my answer: I copied the command from your question, but there is an error: the command as you wrote, it will overwrite udev, you must add /. at the end of the command to copy the files in the directory –  girardengo May 7 at 12:14
    
i tried : cp -f /tmp/ok_pcscd_hotplug.sh /lib/udev/. cp -f /tmp/ok_pcscd_hotplug.sh /lib/udev/ cp /tmp/ok_pcscd_hotplug.sh /lib/udev i don't understand , i'm root but don't copied where is the problem –  user278122 May 7 at 12:39
    
I edited my answer, post in your question also output of mount and lsattr /lib/ –  girardengo May 7 at 13:48
    
mount /lib/ - mount:can't find /lib/ in /etc/fstab or /etc/mtab lsattr /lib/ - Inapppropriate ioctl for device while reading flags on lib/filename output for everyfile –  user278122 May 7 at 14:01
show 2 more comments

Its not necessary every time that you need to be root for this purpose So if you want to do it with root user its fine, but if you want to do it without root, then you have 2 options:

  1. Check the permissions of file. You must have read permissions to that
  2. Check that file or link with same name is not present in the destination directory. Because if link with same name is there in destination directory, it won't allow you to do that and also will not warn that link with same name is present
share|improve this answer
add comment

Try cp /tmp/ok_pcscd_hotplug.sh /lib/udev/ in root user.

share|improve this answer
    
dont change,gives error again - root@atrust-00351A:/lib# ls-l drwxrwxrwx 4 root root 324 2009-05-22 11:40 udev –  user278122 May 7 at 10:55
    
Please post the output whoami and ls -al /tmp/ok_pcscd_hotplug.sh –  Sambit May 7 at 11:26
    
whoami - output root ls -al /tmp/ok_pcscd_hotplug.sh - output -rwxr-xr-x 1 root root 229 –  user278122 May 7 at 11:45
    
Then make sure that ok_pcscd_hotplug.sh is not corrupted and /lib/udev/ exist in your system. –  Sambit May 7 at 13:18
    
either ok_pcscd_hot_plug.sh or /lib/udev avaliable on system –  user278122 May 7 at 13:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.