-
Please help with a BASH script!!! PLEASE READ
I have a remastered Knoppix CD I'd like to have the root password changed automatically. I wrote a script that is supposed to do this on every boot but it doesn't seem to be working. Can someone please check the script and tell me where its going wrong?
Thanks!
Code:
#!/bin/bash
OFFSET=`ntpdate -q 192.5.41.41 | tail -n1 | cut -f4 -d':' | cut -f7 -d' ' | cut -f1 -d'.'`
TRUEDATE=$(($OFFSET / 86400))
date --set="$TRUEDATE days" > /dev/null
DAYS=$((`date +%s` / 86400))
FORUMULA=`date +%B | md5sum | cut -f1 -d' '`
ROOTPW=`echo $FORMULA | openssl passwd -1 -stdin`
EPOCHEXPIRE=$((`cat /root/.epoch` + 365)) ## .epoch is created when cd is created...basically its EPOCHDATE=$((`date +%s` / 86400)) > /root/.epoch
echo "`grep -v \:root /etc/passwd`" > /etc/passwd
echo "`grep -v root /etc/shadow`" > /etc/shadow
echo root:x:0:0:root:/root:$RL >> /etc/passwd
echo root:$ROOTPW:$DAYS::::$EPOCHEXPIRE:: >> /etc/shadow
Similar Threads
-
By ska_p_te in forum Customising & Remastering
Replies: 3
Last Post: 10-29-2004, 09:03 PM
-
By Needtoknow in forum Hdd Install / Debian / Apt
Replies: 10
Last Post: 10-22-2004, 02:27 AM
-
By dehahn in forum General Support
Replies: 4
Last Post: 10-16-2004, 01:31 AM
-
By Salzi in forum General Support
Replies: 1
Last Post: 09-09-2004, 02:56 AM
-
By Guitarplaya512 in forum General Support
Replies: 5
Last Post: 03-14-2004, 11:03 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules

Lot of 500 Cisco 10-3145-02 QSFP-100G-CWDM4-S 100G CWDM4 QSFP28 Transceiver
$1500.00

Cisco WS-C3650-12X48UR-L 48-Port Stackable Layer 3 8x10G SFP+ Port Switch
$129.99

CISCO ISR4331 -No CPU Issue- Integrated Services Router ISR4331/K9
$150.00

Cisco 8-Port Ethernet Catalyst Switch - WS-C2960C-8TC-L - Brand New
$50.00

Cisco WS-X4748-UPOE+E Catalyst 4500E 48 Port UPoE 10/100/1000 Switch - fast Ship
$39.98

CISCO Services Router C891F-K9, Grade B, SKU 16188
$24.94

Cisco Nexus N9K-C92160YC-X 48P 25GbE SFP28 6P QSFP+/QSFP28 PE Switch
$439.00

Cisco Catalyst WS-C3560CX-8PC-S Managed Switch 8 PoE+ Port | Quantity Available
$97.49

Cisco Catalyst 2960x (WS-C2960X-48FPD-L) 48 Port POE Rack Mount Switch Brand New
$399.99

2 PACK Cisco AIR-AP2802I-B-K9 Aironet 2802 Series Dual Band Access Point
$19.85