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'm trying to get a small folder (/test) with a couple small text files to a folder that I don't have write permissions for. I'm the sole user on this account and I don't know why I wouldn't have access.

My first attempt was to use the gui to create a folder but it is not a selectable option when I right click. When I look at the permissions for the folder I want to place my new folder it it the root's and in the root group.

I then tried writing the folder in the terminal which worked.

sudo mkdir /opt/shiny-server/test

So I tried writing the files to the folder but it seems there are many ways to do this and I am confused on what to do. Assume I want to write a very simple text file that might have quotes, less than symbols and other characters in it.

Then I thought the easiest solution might be to just move a directory over using the command line.

sudo mv /Home/Documents/test opt/shiny-server/

But there is "no such directory" for test folder even though I can see it in the gui.

So this is a call for help to learn ubuntu...

  1. I want to know how can I change the permission on this folder to write files and folders.
  2. What is the best way to write text file in a single instance in terminal using a cut paste approach?
  3. What is wrong with my method for trying to move folders?

Thanks! Working with 12.04 here.

share|improve this question
1  
Hi and welcome to the site. Please don't post multiple queries as a single question, break them up into separate ones. The not found issue is because you used opt/shiny-server instead of /opt/shiny-server. The rest are to broad to answer, they will depend on your particular use scenario. As a general rule however, you should not touch anything in /opt unless you know what you're doing. If you want to play with things, do it in your home directory. –  terdon Mar 31 at 19:19
1  
what is /Home/Documents? did you mean /home/$USER/Documents? –  Rinzwind Mar 31 at 19:20

2 Answers 2

up vote 4 down vote accepted

In your mv command you are using a relative path for opt/shiny-server/ so this will only work if you current directory has opt as a subdirectory. To ensure that this isn't the issue use a full path /opt/shiny-server/.

To change permission of /opt/shiny-server/test/ use sudo chmod 777 /opt/shiny-server/test This opens up the permissions for everyone.

A better solution is to change the permission to give You more access sudo chown <username>:<username> /opt/shiny-server/test/

To work with files with strange characters in the name, wrap the filename in quotes, and escape single and double quote within the name "this<>isn\'t aNICE file.name"

share|improve this answer
    
good. thank you very much. –  cylondude Mar 31 at 19:59

Your problem is the difference between absolute and relative path. So opt/shiny-server/ is not the same as /opt/shiny-server/ ; the first starts in the current directory and the second starts at root or /

Same problem with test and /test

See http://www.linuxnix.com/2012/07/abslute-path-vs-relative-path-in-linuxunix.html

share|improve this answer
    
Thanks for the help. –  cylondude Mar 31 at 20:00

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.