Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Can't link to files in /usr/bin, but can copy

  1. #1
    Join Date
    Jun 2021
    Beans
    9

    Can't link to files in /usr/bin, but can copy

    On Ubuntu 20.04, I am trying to create hard links to some essential tools in /usr/bin for use inside a chroot jail. When I try, I get an "Operation not permitted" error. My current workaround is to copy the necessary files to my home directory, and then create links to them there whenever I construct the jail, but of course they won't get updated if the originals do.

    Why is this happening, and is there any way around it?

  2. #2
    Join Date
    Oct 2017
    Location
    City of Waterfalls-Ph
    Beans
    Hidden!
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: Can't link to files in /usr/bin, but can copy

    Did you try to use this command;
    Code:
    sudo chmod
    as administrative user to acquiring root permissions?
    super user do is very important in Ubuntu Linux Operating System this is the administrator command and a powerful command among Ubuntu users
    Now that you have the power, be sure to be safe when you issue your commands. I don't think there is a su-undo, just becareful. Good Luck.
    corn ubuntuforums community.
    Open Source platform where the real world of human is here. Click here for Solve thread
    Rock n' Roll People.
    From: mike_08

  3. #3
    Join Date
    May 2006
    Location
    Switzerland
    Beans
    2,903
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Can't link to files in /usr/bin, but can copy

    Quote Originally Posted by mIk3_08 View Post
    Did you try to use this command;
    Code:
    sudo chmod
    Why that command?? He doesn't need to take ownership. Everything inside /usr/bin belongs to "root". Anything else is asking for trouble.
    Last edited by scorp123; June 7th, 2021 at 07:39 PM.

  4. #4
    Join Date
    May 2006
    Location
    Switzerland
    Beans
    2,903
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Can't link to files in /usr/bin, but can copy

    Hardlinks have to be on the same filesystem, because you're basically addressing the same inodes on the disk, just with 2 x (or more) different filenames at the same time. If source and target filesystems are not on the same disks then hardlinks will fail. Did you try symbolic links? Will those work for your purpose?

  5. #5
    Join Date
    Oct 2005
    Location
    Lab, Slovakia
    Beans
    10,432

    Re: Can't link to files in /usr/bin, but can copy

    A hardlink is just another name for the same file. It cannot work across different partitions/file systems. Technically, it could work on multiple disks if the disks form an array, with one file system across them all.
    Last edited by HermanAB; June 7th, 2021 at 06:17 PM.

  6. #6
    Join Date
    Jun 2021
    Beans
    9

    Re: Can't link to files in /usr/bin, but can copy

    Quote Originally Posted by HermanAB View Post
    A hardlink is just another name for the same file. It cannot work across different partitions/file systems.
    /usr/bin and the directory under /home where my sandboxes go are both within the root directory mounted on /dev/sda5 according to df.
    Last edited by phssthpok2; June 7th, 2021 at 07:47 PM.

  7. #7
    Join Date
    Jun 2021
    Beans
    9

    Re: Can't link to files in /usr/bin, but can copy

    Quote Originally Posted by mIk3_08 View Post
    Did you try to use this command;
    Code:
    sudo chmod
    as administrative user to acquiring root permissions?
    super user do is very important in Ubuntu Linux Operating System this is the administrator command and a powerful command among Ubuntu users
    Now that you have the power, be sure to be safe when you issue your commands. I don't think there is a su-undo, just becareful. Good Luck.
    This doesn't help because (a) I don't want to use sudo (or setuid root!) to run the script to create my sandboxes, and (b) I have r-x access to everything in /usr/bin and write access to the directory I'm trying to create the link in, which should be enough.
    Last edited by phssthpok2; June 7th, 2021 at 07:50 PM.

  8. #8
    Join Date
    Jun 2021
    Beans
    9

    Re: Can't link to files in /usr/bin, but can copy

    Symbolic links won't work from inside a chroot jail.

  9. #9
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    15,615
    Distro
    Kubuntu Development Release

    Re: Can't link to files in /usr/bin, but can copy

    I've run a few programs in chroot environments. I've always had to copy over anything I needed from /etc, /lib, etc., into the equivalent locations in the jail. No links, but actual copies of the files.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  10. #10
    Join Date
    May 2006
    Location
    Switzerland
    Beans
    2,903
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Can't link to files in /usr/bin, but can copy

    Quote Originally Posted by phssthpok2 View Post
    Symbolic links won't work from inside a chroot jail.
    Riiight, I forgot about the jail part. Alternative: Docker containers maybe? I find they are easier to work with than jails anyway...

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

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