Bash: permission denied


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Bash: permission denied
# 1  
Old 01-25-2011
Bash: permission denied

Hello,

I have a problem creating files in a certain folder. I installed apache and mysql today, using this guide:

http[remove]://computerfaq.be/ubuntu-apache-mysql-php-server-installeren/

(can't post links yet Smilie )

Instead of /home/www/html I used /home/www/ for the document root.

Now I wanted to make a file to test if the server worked, so I tried (while in the /home/www/ folder):
Code:
cat > index.html
bash: index.html: Permission denied
sudo cat > index.html
bash: index.html: Permission denied

I've looked at the permission settings for the www folder, however I can't find anything unusual, settings for this folder are currently: drwxrwxr-x, should be sufficient right?

Is it because of the apache server that I cannot create files in this folder? I have solved the problem by making the file somewhere else and then moving it to the www folder, but that is quite cumbersome. Any way to solve this?

Last edited by Scott; 01-25-2011 at 11:31 AM.. Reason: Code tags
# 2  
Old 01-25-2011
what is the ownership and group ownership of that folder ? And who are you logged on as ?
# 3  
Old 01-25-2011
I am logged on as marc.
Code:
marc@s097116:/home$ ls -lh
total 8,0K
drwxr-xr-x 51 marc marc 4,0K 2011-01-25 15:56 marc
drwxrwxr-x  2 root root 4,0K 2011-01-25 16:00 www

Shouldn't I be able to create a file with these settings, if I use sudo?

Last edited by Scott; 01-25-2011 at 11:32 AM.. Reason: Code tags
# 4  
Old 01-25-2011
if sudo allows you to run as root or a user in group root...try "sudo id" and check who it runs as...
# 5  
Old 01-25-2011
Okay, I tried that:

Code:
marc@s097116:/home$ id
uid=1000(marc) gid=1000(marc) groups=1000(marc),4(adm),20(dialout),24(cdrom),46(plugdev),111(lpadmin),119(admin),122(sambashare)
marc@s097116:/home$ sudo id
[sudo] password for marc: 
uid=0(root) gid=0(root) groups=0(root)


No idea how to read this though..

Moderator's Comments:
Mod Comment Please use CODE tags for console output and listings
# 6  
Old 01-25-2011
Ah...its because the local shell is doing the redirect, and although the "sudo cat" is running as root, the redirect is being done by the shell...
Try:
Code:
sudo "cat > index.html"


Last edited by citaylor; 01-25-2011 at 11:38 AM.. Reason: I was talking rubbish
# 7  
Old 01-25-2011
Nope, no good:

Code:
marc@s097116:/home/www$ sudo cat > /home/www/test.html
bash: /home/www/test.html: Permission denied

Strange that I can move files to the folder though :S
 
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