script to change root password

Post Reply
Message
Author
jonnken
Posts: 120
Joined: Thu Mar 14, 2019 12:22 pm

script to change root password

#1 Post by jonnken »

Just a post of the terminal script...to change root password: sudo -i passwd
type in new password twice...and you're finished.
Regards, jonnken...since Feb 2019
Dell Latitude E6440...Intel Core i5-4310M...240G SSD...MX-19.4_x64
Dell Optiplex 755...Intel Core2 Duo E8500...300G HD...MX-19.4_x64

User avatar
figueroa
Posts: 1053
Joined: Fri Dec 21, 2018 12:20 am

Re: script to change root password

#2 Post by figueroa »

That's not a script.
-i?
The normal way to do this is "sudo passwd root"
You would, then, normally be asked for your user password unless recently cached, and then be prompted for the new root password twice.
Why did you post this?
Andy Figueroa
Using Unix from 1984; GNU/Linux from 1993

jonnken
Posts: 120
Joined: Thu Mar 14, 2019 12:22 pm

Re: script to change root password

#3 Post by jonnken »

Just a new linux user here...wishing there was more bash command content on this channel.
Regards, jonnken...since Feb 2019
Dell Latitude E6440...Intel Core i5-4310M...240G SSD...MX-19.4_x64
Dell Optiplex 755...Intel Core2 Duo E8500...300G HD...MX-19.4_x64

skidoo
Posts: 753
Joined: Tue Sep 22, 2015 6:56 pm

Re: script to change root password

#4 Post by skidoo »

wishing there was more bash command content on this channel
wishing the same, but in the meantime:

tdlp.org Bash Beginners Guide http://www.tldp.org/LDP/Bash-Beginners-Guide/html/
Bash-Beginners-Guide (Rutgers) http://linuxcourse.rutgers.edu/document ... ers-Guide/
linuxcommand getting started book www.linuxcommand.org
Ryan's tutorials: Bash Scripting Tutorial https://ryanstutorials.net/bash-scripting-tutorial/
BASH Programming - Introduction HOW-TO http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
Bash Scripting Tutorial for Beginners https://linuxconfig.org/bash-scripting- ... -beginners

the Advanced Bash-Scripting Guide http://tldp.org/LDP/abs/html/index.html
Barely Legal https://wiki.bash-hackers.org/
GNU Bash Reference Manual https://www.gnu.org/software/bash/manual/bash.html
BASH Frequently Asked Questions http://mywiki.wooledge.org/BashFAQ
shell Style Guide https://google.github.io/styleguide/shell.xml
tips better-bash-scripting-in-15-minutes
Linux Shell Scripting Tutorial https://bash.cyberciti.biz/guide/Main_Page

learn by reviewing examples (and discussions / comparisons / alternatives):
https://commandlinefu.com
http://www.bashoneliners.com/
stackexchange.com
serverfault.com

Simplified manual pages X {--- Y {--- Z
^------ I cannot recommend these. Each presents an identical dataset.
Only 300 or so commands within the dataset are LINUX commands, and the coverage spans a confusing mish-mash of commands (e.g. yum, pacman) from disparate linux distributions.

Glossary of common technical terms https://distrowatch.com/dwres.php?resource=glossary
archived Questions and answers columns https://distrowatch.com/qanda.php
archived Tips and tricks columns https://distrowatch.com/tips.php

Discussion sites/forums:
https://www.unix.com/shell-programming-and-scripting
https://www.unix.com/unix-for-advanced-and-expert-users
https://old.reddit.com/r/commandline

interactive:
http://www.bash.academy/
https://www.learnshell.org/
https://shellcheck.com
https://codeacademy.com

also (not linking any here, plenty exist)
websearch "bash cheat sheet" or "shell scripting cheat sheat"
Last edited by skidoo on Fri Apr 12, 2019 1:48 pm, edited 3 times in total.

User avatar
rokytnji.1
Global Moderator
Posts: 723
Joined: Sun Apr 13, 2014 9:06 pm

Re: script to change root password

#5 Post by rokytnji.1 »

Nice post ^^^^^^^^ edit: ?sticky?

I keep this around for stuff hard to remember
https://launchpad.net/clicompanion

2nd. Edit. I'll throw this in here also.

https://www.cyberciti.biz/

I borrow their command tips also.
https://www.cyberciti.biz/tips/top-linu ... tools.html

User avatar
Jerry3904
Administrator
Posts: 21960
Joined: Wed Jul 19, 2006 6:13 am

Re: script to change root password

#6 Post by Jerry3904 »

Thanks, skidoo!

https://mxlinux.org/wiki/other/writing-bash-scripts/

Make changes in the Comments
Production: 5.10, MX-23 Xfce, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 16 GB, SSD 120 GB, Data 1TB
Personal: Lenovo X1 Carbon with MX-23 Fluxbox and Windows 10
Other: Raspberry Pi 5 with MX-23 Xfce Raspberry Pi Respin

skidoo
Posts: 753
Joined: Tue Sep 22, 2015 6:56 pm

Re: script to change root password

#7 Post by skidoo »

.
no point marking the topic sticky unless the title is changed to something snazzy, like, ummm muh toE wont boot`s

skidoo
Posts: 753
Joined: Tue Sep 22, 2015 6:56 pm

Re: script to change root password

#8 Post by skidoo »

comment: glad the info will be more discoverable via wiki page, but the attribution is unwarranted.
It's just a list pulled from bookmarks. It is not comprehensive; the page will benefit from further additions contributed by others.
Help for anyone interested in learning to write scripts for the command line (CLI) from a post by user skidoo.

User avatar
figueroa
Posts: 1053
Joined: Fri Dec 21, 2018 12:20 am

Re: script to change root password

#9 Post by figueroa »

jonnken wrote: Fri Apr 12, 2019 11:06 am Just a new linux user here...wishing there was more bash command content on this channel.
Welcome. Skidoo's list is almost heroic. It the old days, we had books. The Internet resources are like drinking from a fire hose. As you learn, you'll find that it's not just bash, but all of the Unix and Linux shells have much more in common than things that distinguish them and make them behave differently.

Working in bash is generically called shell programming or shell scripting. Be sure to learn about files and directories. Learn how to use a good editor. Create a tests directory and better yet, a test platform for experimenting. Working in the shell can result in shooting yourself in the foot. Working as root can be fatal to your installation.
Andy Figueroa
Using Unix from 1984; GNU/Linux from 1993

jonnken
Posts: 120
Joined: Thu Mar 14, 2019 12:22 pm

Re: script to change root password

#10 Post by jonnken »

thanks figueroa, skidoo, roky, jerry....great new resources I'll check out.
Regards, jonnken...since Feb 2019
Dell Latitude E6440...Intel Core i5-4310M...240G SSD...MX-19.4_x64
Dell Optiplex 755...Intel Core2 Duo E8500...300G HD...MX-19.4_x64

Post Reply

Return to “General”