Bash: permission denied


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Bash: permission denied
# 8  
Old 01-25-2011
Ah, I edited my message because the light dawned - please try again with quotes around the command and the redirect...
Code:
sudo "cat > index.html"

Thanks...
This User Gave Thanks to citaylor For This Post:
# 9  
Old 01-25-2011
Still does not work..
Code:
marc@s097116:/home/www$ sudo "cat > test.html"
sudo: cat > test.html: command not found
marc@s097116:/home/www$ sudo "cat" > test.html
bash: test.html: Permission denied
marc@s097116:/home/www$ sudo "cat" > "test.html"
bash: test.html: Permission denied
marc@s097116:/home/www$ sudo "cat >" test.html
sudo: cat >: command not found

I just found out that it does work when I log in using su (i never even knew this existed before :P)
# 10  
Old 01-25-2011
yes, it looks like sudo is just trying to run that string as is, instead of evaluating it using a shell. My recommendation if you are just trying to create an index.html owned by the correct user is to use:
Code:
sudo touch index.html

Sorry about that...
# 11  
Old 01-25-2011
Ah yes, that works, thanks! And another new command learned Smilie
# 12  
Old 01-25-2011
Small hint: as far as I know Ubuntu, in the default Apache installation, uses the mod_userdir module. That means you can create a directory ~/public_html/ which will then be available in the browser as http://localhost/~marc
# 13  
Old 01-25-2011
Okay, thanks for the hint.

I just modified the host file so I can go to the address I want to, and it works fine Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Executing bash file with sudo for the second time, leads to permission denied, for some commands

I have a script that checks if the script has been ran with sudo. If the script is not ran as sudo, the current script is being executed with exec sudo bash. You are asked for a password, you type in the password, success. Everything is perfect - the commands inside the script are ran as sudo.... (1 Reply)
Discussion started by: boqsc
1 Replies

2. UNIX for Dummies Questions & Answers

Permission denied

when i run echo "User” > /dev/tty5 why do i get permission denied? :confused: (2 Replies)
Discussion started by: chinababy
2 Replies

3. Solaris

ISSUE : bash: cd: /rep/prok: Permission denied

Hi All, i have two accounts with acl permissions. I need to provide read access to both users. for one user s109552 "cd" is not working. drwxrws---+ 8 cvsadmin reto 1024 Aug 23 2011 reto su5sr117# su - s109553 $ bash bash-3.2$ cd /rep/reto bash-3.2$ pwd <-------- it... (2 Replies)
Discussion started by: Naveen.6025
2 Replies

4. Linux

Permission denied

I am using korn shell When I type in Telnet on cmd line, I get message "cannot execute" How can I get permission to execute command ? In which dir is telnet located ? I looked in /usr/bin dir. but its not there Thanks (1 Reply)
Discussion started by: paramshamnani
1 Replies

5. UNIX for Dummies Questions & Answers

Permission denied for bash

my file permissions are -rwxrwxrwx for runInstall file and while giving " sudo bash runInstall.sh " then i am getting error " permission denied" now i don't see any reasonable answer for that please suggest what should i do? :eek: got to start DBConnection practice with oracle database and... (4 Replies)
Discussion started by: toshanshu
4 Replies

6. UNIX for Dummies Questions & Answers

bash: permission denied...(after it allows me?)

I'm sure this question comes up a lot, but I'm particularly confused in this situation. I can run my program once, just fine. However, if I try to run it again without recompiling, bash refuses to give me permission. I have a small idea why, but I don't think think I'm right. Here's what I'm... (1 Reply)
Discussion started by: statichazard
1 Replies

7. UNIX for Dummies Questions & Answers

Permission denied

I would like to copy data from local mechine to cluster. Basically, I typed scp -r DVD/ acount@cluster:/ it shows Permission denied. Could anyone please give me a clue to write permission on cluster, please? The poperty of where on cluster I'd like to put is drwxr-xr-x Any idea would... (1 Reply)
Discussion started by: su_in99
1 Replies

8. UNIX for Dummies Questions & Answers

Why do I keep getting .:Permission denied?

I'll start off by saying that I know very little about Unix - however, I do know that I have a .profile file in my home directory, and that I should be able to invoke it by typing . profile. However, when I do this for ANY .filename, I get ".: Permission denied". I'm pretty sure that there is... (12 Replies)
Discussion started by: bbersani
12 Replies

9. UNIX for Dummies Questions & Answers

Permission Denied

I just started computer science at UW Milwaukee. When I access the university Solaris system from PuTTY, I get permission denied when I try to access the file I wrote. Now I really have no idea what I'm doing, I just don't understand why I get permission denied in my won directory. Thank You ... (0 Replies)
Discussion started by: howeezy
0 Replies

10. UNIX for Dummies Questions & Answers

./ Permission Denied.

Could someone tell me why I am getting a permission denied message when I attempt to run this on an out file? Thanks! (8 Replies)
Discussion started by: trouscaillon
8 Replies
Login or Register to Ask a Question