LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 02-29-2020, 05:58 AM   #16
blueray
Member
 
Registered: Feb 2020
Location: Bangladesh
Distribution: Debian, Ubuntu, Linux Mint
Posts: 136

Original Poster
Rep: Reputation: 2

I was actually looking for something like:
Code:
#!/usr/bin/expect -f

set timeout -1

spawn sudo touch test

expect "password"

send -- "MyPWD123\n"

expect "Sorry, try again."

spawn power off

expect eof
This code is probably not working, but just to give an idea:

Last edited by blueray; 02-29-2020 at 05:59 AM. Reason: formatting
 
Old 02-29-2020, 06:02 AM   #17
blueray
Member
 
Registered: Feb 2020
Location: Bangladesh
Distribution: Debian, Ubuntu, Linux Mint
Posts: 136

Original Poster
Rep: Reputation: 2
I was actually looking for something like:

Code:
#!/usr/bin/expect -f

set timeout -1

spawn sudo touch test

expect "password"

send -- "MyPWD123\n"

expect "Sorry, try again."

spawn power off

expect eof
This code is probably not working. This is just to give an idea.
 
Old 02-29-2020, 06:21 AM   #18
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,295
Blog Entries: 3

Rep: Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719
What problem are you trying to solve with that? If you want to have the machine shut down after a failed login attempt there are several ways to accomplish that.
 
Old 02-29-2020, 09:30 PM   #19
blueray
Member
 
Registered: Feb 2020
Location: Bangladesh
Distribution: Debian, Ubuntu, Linux Mint
Posts: 136

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by Turbocapitalist View Post
What problem are you trying to solve with that? If you want to have the machine shut down after a failed login attempt there are several ways to accomplish that.
Sometimes people reset the root password using the boot menu. Even if someone reset the password they are not supposed to know my previous password. I just want to not let the user do anything if they reset with a different password.

I know there is encryption. I just want to use this as just another layer.
 
Old 02-29-2020, 09:44 PM   #20
uteck
Senior Member
 
Registered: Oct 2003
Location: Elgin,IL,USA
Distribution: Ubuntu based stuff for the most part
Posts: 1,172

Rep: Reputation: 501Reputation: 501Reputation: 501Reputation: 501Reputation: 501Reputation: 501
Why not just set a grub password to stop people from changing the boot settings?
You can also set the recovery grub option ask for a root password, so they need to know it to change it.
 
2 members found this post helpful.
Old 03-01-2020, 04:25 AM   #21
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,804

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
they will boot from usb.... If they really want to modify root pw. So you [would] need to disable that too. Using an encrypted volume (=which cannot be accessed without the password) will solve it permanently. But probably you need to reinstall the system to achieve it.

By the way, there is no script which can protect you, if they can reset the password without booting the system.

Last edited by pan64; 03-01-2020 at 04:30 AM.
 
3 members found this post helpful.
  


Reply

Tags
bash, root, root login, security, shell script



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to check if root password and grub password is same or not on RHEL 7 . khpr0502 Linux - Security 3 09-21-2015 09:36 AM
Script to check for text file is different and perform certain action depam Linux - Newbie 3 11-26-2012 09:54 PM
Extract certain text info from text file xmrkite Linux - Software 30 02-26-2008 11:06 AM
how to change some text of a certain line of a text file with bash and *nix scripting alred Programming 6 07-10-2006 11:55 AM
Can't enter text in certain Java text fields TheBelush Linux - Software 4 04-27-2005 05:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 05:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration