Find the answer to your Linux question:
Results 1 to 8 of 8
Hi, I'm having problem copying a file pix7@debian:~/Desktop/Downloads/ddclient-3.7.3$ ls -l total 212 -rw-r--r-- 1 pix7 pix7 11173 2007-07-31 04:04 Changelog -rw-r--r-- 1 pix7 pix7 2684 2007-08-07 14:36 ChangeLog -rw-r--r-- 1 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined! x86scorpion's Avatar
    Join Date
    Mar 2008
    Posts
    7

    Question cp: cannot create regular file `/usr/sbin/ddclient': Permission denied


    Hi, I'm having problem copying a file
    pix7@debian:~/Desktop/Downloads/ddclient-3.7.3$ ls -l
    total 212
    -rw-r--r-- 1 pix7 pix7 11173 2007-07-31 04:04 Changelog
    -rw-r--r-- 1 pix7 pix7 2684 2007-08-07 14:36 ChangeLog
    -rw-r--r-- 1 pix7 pix7 18007 2006-06-15 03:51 COPYING
    -rw-r--r-- 1 pix7 pix7 869 2006-06-15 03:51 COPYRIGHT
    -rwxr-xr-x 1 pix7 pix7 109903 2007-08-07 14:35 ddclient
    -rw-r--r-- 1 pix7 pix7 6403 2007-07-31 15:05 README
    -rw-r--r-- 1 pix7 pix7 1151 2006-06-15 03:51 README.cisco
    -rw-r--r-- 1 pix7 pix7 319 2007-07-31 15:06 README.ssl
    -rw-r--r-- 1 pix7 pix7 876 2006-06-15 03:51 sample-etc_cron.d_ddclient
    -rw-r--r-- 1 pix7 pix7 5180 2006-06-15 03:51 sample-etc_ddclient.conf
    -rw-r--r-- 1 pix7 pix7 634 2006-06-15 03:51 sample-etc_dhclient-exit-hooks
    -rw-r--r-- 1 pix7 pix7 668 2007-08-08 03:12 sample-etc_dhcpc_dhcpcd-eth0.exe
    -rw-r--r-- 1 pix7 pix7 1355 2007-07-07 20:37 sample-etc_ppp_ip-up.local
    -rwxr-xr-x 1 pix7 pix7 1850 2006-06-15 03:51 sample-etc_rc.d_init.d_ddclient
    -rwxr-xr-x 1 pix7 pix7 1692 2006-06-15 03:51 sample-etc_rc.d_init.d_ddclient.lsb
    -rwxr-xr-x 1 pix7 pix7 801 2006-06-15 03:51 sample-etc_rc.d_init.d_ddclient.redhat
    -rwxr-xr-x 1 pix7 pix7 856 2006-09-30 21:14 sample-etc_rc.d_init.d_ddclient.ubuntu
    -rw-r--r-- 1 pix7 pix7 362 2007-07-30 15:10 TODO
    pix7@debian:~/Desktop/Downloads/ddclient-3.7.3$ cp ddclient /usr/sbin/
    cp: cannot create regular file `/usr/sbin/ddclient': Permission denied
    pix7@debian:~/Desktop/Downloads/ddclient-3.7.3$
    How do I copy it using comand line?

  2. #2
    Linux Engineer jledhead's Avatar
    Join Date
    Oct 2004
    Location
    North Carolina
    Posts
    1,077
    you could login as root
    #su -

    and then copy it

    Or better yet, learn to use sudo
    #apt-get install sudo
    #man sudo

  3. #3
    Blackfooted Penguin daark.child's Avatar
    Join Date
    Apr 2006
    Location
    West Yorks
    Posts
    4,393
    The error message says it all really,
    cp: cannot create regular file `/usr/sbin/ddclient': Permission denied
    Most users cannot write outside their own home directory by default (except in places like /var/tmp, /tmp and other temporary directories). This means that you need to be root in order to copy that file to /usr/sbin. Also note that if you copy that file to /usr/sbin only root will be able to use it without entering the full path of the command because */sbin directories are not usually in the path of normal users.

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined! x86scorpion's Avatar
    Join Date
    Mar 2008
    Posts
    7
    su saved my day!

    pix7@debian:~/Desktop/Downloads/ddclient-3.7.3$ su
    Password:
    debian:/home/pix7/Desktop/Downloads/ddclient-3.7.3# cp ddclient /usr/sbin
    debian:/home/pix7/Desktop/Downloads/ddclient-3.7.3#


    thanks guys!
    I love this forum! How do I mark this thread solved?

  6. #5
    Just Joined!
    Join Date
    Dec 2010
    Posts
    2
    Quote Originally Posted by daark.child View Post
    you copy that file to /usr/sbin only root will be able to use it without entering the full path of the command
    I "su'ed" into root, but I still cannot copy files (i.e., I get the same error message as a regular user). Perhaps root is not as powerful on my machine. Please advise ASAP as I have a mount point on one machine which points to a directory on another machine, and I am trying to copy a file (me_accts.tar) from the source machine to the destination machine on the mounted directory. I have a deadline for configuring this application. Attached screenshot shows the activity in question. Thanks.

    Attached Images Attached Images

  7. #6
    Just Joined!
    Join Date
    Dec 2010
    Posts
    2
    One thing I did was (while su'ed as root) su as the owner of the file, then perform the copy (cp command)...that seemed to work.

    But the point is that as "root", I should be able to copy files from anywhere to anywhere, no matter who the owner is. Why do I need to go that extra route?

  8. #7
    Blackfooted Penguin daark.child's Avatar
    Join Date
    Apr 2006
    Location
    West Yorks
    Posts
    4,393
    You need to change to root using "su -" and not simply "su". That way you will get all of roots environment and settings.

  9. #8
    Just Joined!
    Join Date
    Dec 2010
    Posts
    9
    Add the user to /etc/sudoers

    You can do that by saving the following line at the end of the sudoers file.

    pix7 ALL=NOPASSWD: ALL

    Once you are done, use sudo before any command which requires root permissions.

    eg: sudo cp ddclient /usr/sbin/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •