Problems activating "mod_rewrite" (I can't edit 000-default file)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problems activating "mod_rewrite" (I can't edit 000-default file)
# 1  
Old 02-06-2012
Problems activating "mod_rewrite" (I can't edit 000-default file)

Hello everyone,

Maybe an expert could help me..

I'm trying to activate mod_rewrite module on a Ubuntu 11.04 server (natty) and I having problem to edit the file 000-default in 3rd step, the steps to activate the module are:
1-Install Apache web server in Ubuntu Linux
2-Enable mod_rewrite module in Apache web server with:
Code:
$ sudo a2enmod rewrite

3-Edit the site file 000-default located in: /etc/apache2/sites-enabled/ directory, changing all AllowOverride None to AllowOverride All:
Code:
/etc/apache2/sites-enabled/000-default

4-And finally, restart Apache with:
Code:
sudo /etc/init.d/apache2 restart

The file looks blue when I see it in terminal with "ls" and a print is as below:
Code:
$: /etc/apache2/sites-enabled$ ls -la
total 8
drwxr-xr-x 2 root root 4096 2011-10-14 09:50 .
drwxr-xr-x 7 root root 4096 2011-11-11 06:48 ..
lrwxrwxrwx 1 root root   26 2011-10-14 09:50 000-default -> ../sites-available/default

I have sudo access, using vim I can do the changes but when I try to save changes I receive:
E45: 'readonly' option is set (add ! to override)

Why this is happening?
How can I edit this file?


Many thanks in advance for any help.

Regards
# 2  
Old 02-06-2012
It is a symbolic link so the permissions are determined by those of ../sites-available/default. You can either change these permissions or use :w! to write the file..
This User Gave Thanks to Scrutinizer For This Post:
# 3  
Old 02-06-2012
Hello Scrutinizer, thanks for answer.

I've just see the ../sites-available/default I didn't know about that relation.

So, you meam if I edit
../sites-available/default will be enough and that edition will automatically change the 000-default file?

Thanks for help so far.

Regards
# 4  
Old 02-06-2012
When you do vim 000-default, you are really editing ../sites-available/default through the symbolic link. If you change the permissions like this: chmod u+w 000-default - which means you are giving write access to the owner of ../sites-available/default - then you will no longer get that message..

Alternatively if you exit vim after your changes, using :w! you should be able to override the readonly permissions..
This User Gave Thanks to Scrutinizer For This Post:
# 5  
Old 02-06-2012
Thank you, thank you Scrutinizer, it works!!!

Only 2 questions more:
the 000-default had before permissions 777 and wasn't working for me after I did chmod u+v how you suggested me. Why?

Do I need to change back the permissions of 000-default to something? if yes, to what level permission?

Many thanks really for your great help

Regards
# 6  
Old 02-06-2012
It is u+w , not u+v (see man chmod) . The permissions weren't 777, because those belong to the symbolic link, not the actual file (../sites-available/default).. You can check the permissions of that file with
Code:
ls -l ../sites-available/default

alternatively if you use
Code:
ls -lL 000-default

ls will follow the symbolic link and display the permissions of the actual file. I would expect the permissions to be 444 ( -r--r--r-- )
# 7  
Old 02-06-2012
You are correct, is chmod u+w, it was a typo Smilie.

The permissions are as follow:
Code:
/etc/apache2/sites-available$ ls -l
total 12
-rw-r--r-- 1 root root  946 2012-02-06 18:24 default
-rw-r--r-- 1 root root 7469 2011-02-22 11:34 default-ssl

and
Code:
etc/apache2/sites-enabled$ ls -l
total 0
lrwxrwxrwx 1 root root 26 2011-10-14 09:50 000-default -> ../sites-available/default

/etc/apache2/sites-enabled$ ls -lL 000-default
-rw-r--r-- 1 root root 946 2012-02-06 18:24 000-default

I still have to change the permissions to 444 in 000-default file?

Thanks again for your help
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

2. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

3. AIX

Can we directly edit "/etc/environment" file in AIX using vi ?

Hi Is it recommended to edit the file "/etc/environment" directly using vi ? (like by adding some export something= value staements) or do we need to edit /etc/profile file in order to set the environment variables, globally to the entire AIX LPAR please suggest. (5 Replies)
Discussion started by: System Admin 77
5 Replies

4. Web Development

How would I mod_rewrite "/~a1Pha" and "/=a1Pha" to "/paste/a1Pha.htm"? (internally & externally)

Basically I want to shorten URLs on my html pasting site (pasteht.ml), by using "/~a1Pha" instead of "/paste/a1Pha". The ID is 5 numbers and letters, both cases. For example: /~idnum serves /paste/idnum.htm /=idnum serves /paste/idnum.htm /paste/idnum redirects to /~idnum (to update any old... (0 Replies)
Discussion started by: phillips1012
0 Replies

5. Shell Programming and Scripting

Problems with "write" and "wall"

Hello, I am using VirtualBox to simulate a small network with two Linux computers, the host is Mac OS X. My problem is that I can't send "write" and "wall" messages from the host to one of those Linux computers. Here is what works: - The virtual Linux computer answers "ping" messages that have... (5 Replies)
Discussion started by: 123_abc
5 Replies

6. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

7. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

8. News, Links, Events and Announcements

Microsoft "Donates" $3,000,000,000 to Feds

Surreal quote from the news link below: http://www.washingtonpost.com/wp-dyn/articles/A44615-2002Nov12.html (0 Replies)
Discussion started by: Neo
0 Replies
Login or Register to Ask a Question