Programming :: Replace A Hash In A Shadow File Not Using Passwd?
Aug 5, 2010What is the easiest way to replace a hash in a shadow file for one particular user, not using passwd, and when the current password is unknown?
View 3 RepliesWhat is the easiest way to replace a hash in a shadow file for one particular user, not using passwd, and when the current password is unknown?
View 3 RepliesI deleted root from passwd and shadow file.Can I crate a new root user?
View 1 Replies View Relatedthe last filed of /etc/passwd file is the login_shell;how if I replace it to /usr/bin/date
what would it happen.by the way I try to use $ subut do't know the password.what s the default root passworf for ubuntu
I am trying to use John the Ripper but it doesn't take regular MD5 hashes, only shadow MD5 hashes. For example this hash: 900150983cd24fb0d6963f7d28e17f72 (which, decrypted, is 'abc') within a text file, John the Ripper does not detect because it is not shadow format. How can I convert this MD5 hash into shadow format?
View 1 Replies View RelatedHow to create the password hash exactly the same as in shadow file (from the command line)?
The command
openssl passwd -crypt
returns something different.
In what cases would a user appear in /etc/shadow and not /etc/passwd
View 2 Replies View RelatedI am bulding my own image based on 2.6.32 kernel, I wish to add a guest user:
In a script thats invoked by the makefile, I use 'useradd' command & this updates the shadow, passwd files under /etc on the host, is it possible to tell the command to create the shadow / password under some other folder on the host? may be /tmp?
I am trying to write a remote access module. Is there any function in linux where I can give string (password entered by user) and compare it with the actual user password stored in /etc/shadow. Since the password is stored encrypted in /etc/shadow I cannot parse and compare. So I want some method to compare if my user entered the correct password..Is there any function for that..
View 6 Replies View RelatedIts 2 weeks i'm trying to configure freeradius2 on centos5 64bit after installed it from yum.all seems working, but i cant authenticate unix users.after digging in many sites its simply cant find user name and password ( ++[unix] returns notfound )Also how can i paste here all the radiusd -X log lines? i can't find any
radius.log file.
creating a script which evaluates whether or not the passwd file has changed.
View 4 Replies View RelatedI have been working on Kerberos and Ldap Authentication on SUSE 11.3.
I was successful with Kerberos authentication and had no issue. then i moved to configure LDAP as i want to configure this authentication method for APACHE server.
Now after configuring ldap and pam, I am able to check the command 'getent shadow' with no issue and this command lists all the users of that OU too. but when i try getent passwd or getent group , it results nothing but local users.
I have script that I'm working on that updates a username in all the files that are called blah.inc for my framework. since i host a bunch of these web apps i need to do it to all of them. so I need to figure out how to update these files automagically with out me watching it to call vim every time. heres what I have so far
Code:
This finds the files but now i need to figure out how to do s/bob/fred/g on those files.
I have a file, "outfile" what I wish to insert into a file called template where it finds "OVERRIDES". I am getting an error.
Code:
However I can do something like this and it works fine
Code:
I am guessing its because of the file size or multiple lines.
A sample of the outfile text is below
Code:
I've found some scripts that replaces a string in a file but it's not quite working for me.
And I'm trying to replace a tag in an xml file that looks like this
So I ran a command line like this perl -w -i -p -e "s/xmlns="'http://mydomain.org/replacethese.xsd'">/>/g" testfile.xml
And I get a error output
Search pattern not terminated at -e line 1.
Found the script from this blog [url]
There are a few things I was wondering about (using tools available in bash):How to insert a file at at the specified location of another.How to copy a portion of a file between two lines matching a regex to another file (and/or making sed only work between two lines matching a regex)How would you do this?
View 2 Replies View Relatedi need to change a binary file, let's say to find and replace username:
find string: "/home/name/bla-bla-bla/ "
new string: "/home/anewname/bla-bla-bla/ "
i can do it, for example, in emacs (hexl-mode), but interesting in writing a script instead. it will be much more better for me if i could do it automatically. is there an analog of: sed 's/string1/string2/g' ? P.S. the best way is to recompile the binary files i have, but there are no sources available.
I know how to replace a particular instance (say 3rd one) of a word in a line using sed based on the sed one-liners. However I would like to replace a particular instance of a word in the entire file.
For example, here is a file:
Code:
John
Betty
Jack
Ron
Jack
Paul
So now I would like to replace the second instance of Jack (in red color) with "Rob" (for example). Not quite sure how to do that? I tried couple of things from here but they did not work.
I have question about replacing a string in a file.
How can I replace the printerb's 10.1.1.1 to something else(10.1.1.2, for example) without replace printera's 10.1.1.1 accidentally?
I have tried perl -e -pi "s/10.1.1.1/10.1.1.2/g" /etc/hosts. but, perl replace both 10.1.1.1 to 10.1.1.2.
I often get files with many spaces as part of their names. I would like to automatically replace these spaces with underscores, but otherwise not change the file name. Is there a way to do this task with just the bash shell?
View 4 Replies View RelatedI am trying to replace the default path in a file(which is a script)with the new path which I have get when the bash script runsThe code is
SCRIPT=$(readlink -f $0)
SCRIPTPATH=`dirname $SCRIPT`
sed -i "s/$HomeDir/$SCRIPTPATH/g" <filename>
[code]....
[code]...
The variables are clean and available in my script. No prob. $old is an IP-address of a server, $new as well. replacement-file is an xml-file (the ip-address to be changed is within an xml-tag). It should be trivial, but it isn't. I spent the last 3 hours reading about the problem, trying several different 'solutions' or workarounds. It should work, the '"' should take care that the variables get expanded, but whatever I try the old server IP isn't replaced.
I want to read from the file and check for the pattern, if the line has some word like <string>: then string should be copied into buffer. Afterwards, I want to insert the same <string> with some word in the next line of the file. use sed command to perform the above mentioned operations?
View 2 Replies View RelatedI am beginner in this business of shell script and I have no idea how to do the following: I would like to replace the lines of my file that contains 'CFL=' by 'CFL=0.5'. Note that I want to replace the full line meaning
View 11 Replies View RelatedCode:
#!/bin/bash
VARR=`cat /proc/asound/cards | grep HDMI | cut -c 1-2`
VARX="defaults.ctl.card $VARR"
VARY="defaults.pcm.card $VARR"
FILE1="alsa"
FILE2="alsa.new"
echo $VARX
echo $VARY
sed "s/defaults.ctl.card*/'$VARX'/g" $FILE1 > $FILE2
This is what I have right now. Well, I thought I knew sed, and apparently I don't... I tried writing this for someone else, and this has given me trouble, so since the user pretty much figured it out on his own, here it goes.
Say VARR=1, so VARX and VARY contain the above text, appended by 1.
What I am trying to do is replace the text "defaults.ctl.card 0" by VARX and "defaults.pcm.card 0" by VARY. The contents of FILE1 is the file being used to search for both text fields, and FILE2 is the output file. I tried using single quotes, double quotes, and a mixture of both, and no go whatsoever. So my question... What is the proper way of searching for text within a file and replacing with a variable?
I'm wanting to mod some PHP files across a hierarchy and thought I'd drive it with find + grep + xargs
I built up a command line which I was confident would do the job, but now can't save the results.
First I tried this:
Code:
find . -name *.php | xargs grep serialize | cut -d: -f1| sort -u | xargs sed -i s/serialize/serialise/g
but that didn't work:
Code:
sed: illegal option -- i
so I thought I'd try using
Code:
[Code].....
Is there any way to use sed to replace certain text in a file with the persons username automatically? Right now i'm using
Code: Select allsed -i.bak s/STRING_TO_REPLACE/STRING_TO_REPLACE_IT/g file.foo
I would like it to automatically inject the persons usrname in the replacement string. Is this possible? I've been looking on line at various sed tutorials and I cant quite find what i'm looking for. I also didn't really see anything in the forums search function.Essentially i'm trying to take this file URL...Android.rules and replace all instances of username with the persons actual username automatically.
Code: Select allsed -i.bak s/username/$USER/g 51_Android.rules
I am trying to rename a lot of files but need to keep the extension :
the files are films names :
a.b.c.d.***.iso
the result should be replacing "." by spaces " "
this command :
for files in *.iso ; do mv "$files" `echo "$files" | tr '.' ' '`; done
put a space also before the extension iso ??
How can I rename files from
"a.b.c.d.iso" to "a b c d.iso"
As indicated in the subject, I want to search a text. If the text is present I want to replace it. But if the text is not present, I want to insert it after first line and before last line.
Searched text is:CleanCache "*";
Where * can be anything.
Example: CleanCache "false"; -> CleanCache "true";
If CleanCache "false"; is not present, only insert CleanCache "true"; after first line and before last line.
I want to use SED to do the following: In a text file replace any occurrences of the three character string ZZZ with a quotation mark "and. replace all occurrences of a comma with a semi-colon. It is the S/ / / command which is stumping me on the first issue...inparticular how to get the replace string to be quote.
View 9 Replies View RelatedSomething very handy to do in a Linux shell, is manipulating files and strings - essentially parsing data. Write a utility which will scan in a text file and search and replace strings. We also want to keep track of how many strings we've replaced.
I know that my command would look like this: <utility name> <filename> <stringToSearchFor> <stringToReplaceWith>
Code: #!/bin/bash
[code]....