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.

Is it possible to run a program in a fake environment?

I have a tool that requires a certain folder to be in /mnt/cdrom. I have the all the files from that cdrom stored in another folder, say /home/me/stuff. How can I pretend (just for one run of that program) that /home/me/stuff is actually /mnt/cdrom? I do not have root access so mount will not work.

share|improve this question
    
I take it this tool will not accept a symlink? e.g. ln -s /mnt/cdrom /home/me/stuff (assuming /home/me/stuff does not already exist) –  geirha May 31 '12 at 7:09
    
@geirha That command will create a symlink called /home/me/stuff to /mnt/cdrom. This will succeed if /mnt/cdrom exists (in Ubuntu by default it does not), but that will not make it possible to alter the contents of /mnt/cdrom (which by default even if it did exist, you'd have to be root to accomplish). In contrast, if you meant ln -s /home/me/stuff /mnt/cdrom, that would attempt to create /mnt/cdrom as a symbolic link to /home/me/stuff, but this will fail if you are not root because only root can modify the contents of /mnt by default. –  Eliah Kagan May 31 '12 at 7:13
    
@EliahKagan I meant what I said. henkenen did not specify whether write access was needed, only that the content of /mnt/cdrom should be available as /home/me/stuff. –  geirha May 31 '12 at 7:15
    
@henkenen Can you tell us more about the program, its name, what it does, why it needs to access /mnt/cdrom, what language it's written in (if you know)? You can edit your question to provide this info. If you are going to be able to fool the program into thinking /home/me/stuff is really /mnt/cdrom, the way you do it will probably depend on some of these details. For example, if the program is a script (a text file containing code in an interpreted language, that can run as an executable), you could just edit it to use /home/me/stuff instead of /mnt/cdrom. –  Eliah Kagan May 31 '12 at 7:15
    
@geirha No, you have misunderstood the question. The files are not in /mnt/cdrom. The files are in /home/me/stuff. The OP needs to get the program to access them in /home/me/stuff even though the program is only designed to access them in /mnt/cdrom. –  Eliah Kagan May 31 '12 at 7:16

1 Answer 1

you could run it in a chroot environment..but odds are chroot would 1 require a fair amount of work, and 2. more importantly would require root access. (in which case sudo ln -s /mnt/cdrom /home/me/stuff would be much easier. ).

I would suggest just having a VM you can boot/play. VMware Player can play a VM you setup somewhere else...and you probably can run VMware player or Virtualbox from your $HOME w/o installing it. With some work.

share|improve this answer

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.