I found a question in the Ubuntu_20.04_LTS_STIG 1.5.2 that reads,
The Ubuntu operating system must automatically remove or disable emergency accounts after 72 hours...
What is an emergency account? Is it different from booting in rescue mode?
I found a question in the Ubuntu_20.04_LTS_STIG 1.5.2 that reads,
The Ubuntu operating system must automatically remove or disable emergency accounts after 72 hours...
What is an emergency account? Is it different from booting in rescue mode?
How do I get the username from within a script that was called with sudo? In other words, I don't want root
but the actual username.
echo_user.sh
#!/usr/bin/env bash
echo whoami
Calling the script from user pikachu, I would expect it to print pikiachu and not root.
sudo ./echo_user.sh
There are lots of post from around 7 to 12 years ago with this exact question. None of them seem to work on Ubuntu 22.x. I'm simply trying to get the name of the user that called a script with sudo. Most of the old examples reference SUDO_USER
but the only way I've been able to get it to work is by running sh -c 'echo $SUDO_USER'
. echoing SUDO_USER from a script shows it's undefined.
I have 2 3.5" WD20EARS disks. durring a format/wipe, there was a power failure and now i'm unable to access either disk. I would normally think that it's just a dead disk but since it happened on both, I doubt it.
SMART results say that both disks are OK
Here are a few things I've tried.
parted
$ parted /dev/sdf
Warning: Error fsyncing/closing /dev/sdf: Input/output error
fdisk
$ fdisk /dev/sdd
Welcome to fdisk (until-linux 2.31.1).
fdisk: cannot open /dev/sdf: Input/output error
formatting using the graphical ubuntu disk utility
Error wiping device: Failed to probe the device '/dev/sdf' (udisks-error-quark, 0)
fsck
$ fsck/dev/sdf
fsck.ext2: Input/output error while trying to open /dev/sdf
ddrescue this is able to read the disk but I don't really care about the data on this drive, I just want it working again.
hdparm
$ hdparm --verbose --write-sector 3907029168 --yes-i-know-what-i-am-doing /dev/sdf
re-writing sector 3907029168:
I don't actually know what I'm doing with this one :p It's not erroring out but I'm not sure it's actually doing anything.
:::EDIT::: hdparm finally finished. here are the results,
sudo hdparm --verbose --write-sector 3907029168 --yes-i-know-what-i-am-doing /dev/sdf
/dev/sdf:
APT: No idVendor found -> not USB bridge device
re-writing sector 3907029168:
oflags.bits.lob_all=0xfc, flags={ nsect lbal lbam lbah dev command }
oflags.bits.hob_all=0x3c, flags={ nsect lbal lbam lbah }
using LBA48 taskfile
outgoing cdb: 85 0b 06 00 00 00 01 e8 b0 00 88 00 e0 e0 34 00
outgoing_data: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
SG_IO: ATA_16 status=0x2, host_status=0x0, driver_status=0x8
SG_IO: sb[]: 70 00 05 00 00 00 00 0a 10 51 e0 01 21 00 00 00 a0 b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00
SG_IO: bad/missing sense data, sb[]: 70 00 05 00 00 00 00 0a 10 51 e0 01 21 00 00 00 a0 b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00
SG_IO: desc[]: 10 51 e0 01 21 00 00 00 a0 b0 00 00 00 00 00 00 00 00 00 00 00 00
ATA_16 stat=00 err=01 nsect=00 lbal=00 lbam=b0 lbah=00 dev=00
succeeded
I says succeeded, but nothing appears to have changed