sed replace #PermitRootLogin yes


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sed replace #PermitRootLogin yes
# 8  
Old 01-11-2010
Hi Mark.

There is nothing wrong with your original code. There's nothing fancy about it!

Good luck!
# 9  
Old 02-22-2010
All, I just ran this using a \# and it worked, but without the escape it didn't work.

I also ran it without the \ escape and it worked. no idea what I was seeing before that could have caused the issue.

Code:
sed -e 's/#PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

sed Replace

I have a file whose output words are always like this: aaaa bbbb cccc dddd. Trying to arrange the data so that there are 2 columns such that the 1st word become the 1st column like this: aaaa aaaa aaaa bbbb aaaa cccc aaaa dddd Trying to use awk... (8 Replies)
Discussion started by: jimmyf
8 Replies

2. Shell Programming and Scripting

Sed/replace help

How can we empty or replace with null, following block of code (within the php quotes including the quotes) from inside a file. *** some other data above this code <? #317008# ... (5 Replies)
Discussion started by: fed.linuxgossip
5 Replies

3. Shell Programming and Scripting

sed replace

Hi, i have a file as give below >cat sample_file param1 val1 2012-06-19 ##there can be one or more space after 2012-06-19 in the above file i want to replace val1 with a with value passed through a variable... below is the command i tried >parval='param1 val2' >par1=param1 >sed... (3 Replies)
Discussion started by: midhun19
3 Replies

4. UNIX for Dummies Questions & Answers

sed - replace

i want to replace: /abc/123/script with /abc/scripts i tried sed -e 's///g' but did not work. Please use code tags <- click the link! (2 Replies)
Discussion started by: lawsongeek
2 Replies

5. Shell Programming and Scripting

Sed help with replace

phx,v3apilw2core,app-usage,05-03-2010, phx,tr(white,wavern), 2,1 I need help with the sed command to remove the text in red from the line above, including braces. I tried the following two approaches:- sed '/(/,/)/ !d' test.txt | more sed "/(/,/)/ !d" test.txt | more (1 Reply)
Discussion started by: smee
1 Replies

6. Shell Programming and Scripting

How to use sed to replace the a string in the same file using sed?

How do i replace a string using sed into the same file without creating a intermediate file? (7 Replies)
Discussion started by: gomes1333
7 Replies

7. Shell Programming and Scripting

Loop with sed command to replace line with sed command in it

Okay, title is kind of confusion, but basically, I have a lot of scripts on a server that I need to replace a ps command, however, the new ps command I'm trying to replace the current one with pipes to sed at one point. So now I am attempting to create another script that replaces that line. ... (1 Reply)
Discussion started by: cbo0485
1 Replies

8. Solaris

Solaris 8 PermitRootLogin

Hi All, The file /usr/local/etc/sshd_config have no lines about PermitRootLogin yes or PermitRootLgoin no What does it mean? No login for root or it does. Thanks in advance. :) (5 Replies)
Discussion started by: itik
5 Replies

9. Shell Programming and Scripting

using sed to replace ' with `

Dear All, I am writting a shell script program on AIX server version 5.3 in which I am doing cleaningprocess for files in which I am trying to replace ' with ` . and for this I am using following command: sed -e 's//$/g' -e 's/\\/\//g' -e 's/'/`/g' $file >>... (2 Replies)
Discussion started by: mr_dba01
2 Replies

10. Shell Programming and Scripting

How to replace using SED?

Hi, I want to change a particular string in a file with another string. This is part of a larger script file. I m using SED for this purpose: sed -e 's/hostname.domainname/${HOST}.${DOMAIN}/g' $sed_file>$tmp_file Where the occurance hostname.domainname has to be replaced with the... (4 Replies)
Discussion started by: mahatma
4 Replies
Login or Register to Ask a Question