3 votes

Override LDAP shell

Thirteen years later ... for anyone finding this post while looking for a way to locally override the shell for a specific LDAP user on a specific host, there's a way you can do it by writing the ...
Chris Robison's user avatar
3 votes

how to make a shell execute with suid

What you are doing wrong is running face-first into a security measure designed to keep the system safe. Bash, dash, and other shells detect that they're being run setuid root and immediately drop ...
Jonathan Beverley's user avatar
3 votes
Accepted

How to save input colors in awk?

some_command may have an option to force color even when it's connected to a terminal, for example with grep it would be --color=always. If it doesn't though you have to trick some_command into ...
Arkadiusz Drabczyk's user avatar
3 votes
Accepted

Passing a user input to an ssh command

You have a space between -p and the password variable, but according to the mysqldump man page: If given, there must be no space between --password= or -p and the password following it.
Jim Redmond's user avatar
3 votes

How to do fuzzy match with linux alias

Too long for a comment: I usually use "root" to login in my linux, but I want to make shell forbid dangerous commands The best way is to simply not log in as root directly. Set up a ...
HBruijn's user avatar
  • 80.3k
3 votes

Why doesn't systemd capture output from subprocesses of a user service written in shell script?

EDIT 2: An observant colleague who has root reports that (a) the subprocess output is in the journal, it's just not associated with the service, and (b) he only sees this behaviour with a user service;...
u1686_grawity's user avatar
2 votes

How can I display the IP address of an interface?

On recent OS and tools versions, using JSON interface should work too, e.g.: ip -json addr show docker0 \ | jq '.[].addr_info[] | select(.family == "inet").local' Which yields on my ...
Superlexx's user avatar
2 votes

How do I mount the OS (system) disk from the UEFI shell?

A little late, but just came across this question, when having the same issue. This should mount all disks Shell> map -r Shell> fs0: fs0:\>
user1270949's user avatar
2 votes
Accepted

detect if zone transfer with dig succeed or not via return code

The exit status ($?) of the dig command does not reflect whether the zone transfer was successful or not. We could check the output file for the error message like that: CHARSET=ASCII dig domain.com ...
Saxtheowl's user avatar
  • 1,172
2 votes

crontab shell script execution not as expected

The solution was found here which essentially says that goaccess has a specific requirement to add a hyphen in the parameters to process multiple files. However for some reason, it works without this ...
kevincw01's user avatar
2 votes
Accepted

pgrep -f from shell script is returning 2 pid instead of 1

The two PIDs that the script returns are the PID of the process interpreting the script (which contains ServiceResilience in its command line) and the PID of pgrep (which also contains ...
tsc_chazz's user avatar
  • 1,866
2 votes
Accepted

How to convert text file from BASH to HTML?

Put it inside <pre></pre>? The <Pre> Tag defines preformatted text. Text in a <pre> element is displayed in a fixed-width font, and the text preserves both spaces and line ...
Esa Jokinen's user avatar
  • 49.8k
2 votes

cd command not recognized by a systemd service script

It was indeed an absolute path issue so I just hard coded the path to the bin folder I have and it worked.
Dev Dev's user avatar
  • 31
1 vote

HEREDOC in Dockerfile produces no output

Parsing this command: RUN <<-EOF > /root/.npmrc registry=https://\${NPM_VIRTUAL_REGISTRY_REPO_URL} strict-ssl=false always-auth=true email=\${PUBLISHER_EMAIL} //\${...
BMitch's user avatar
  • 6,319
1 vote

change shell to /usr/bin/false in IBM aix os

I discovered that the login shell attribute is defined in the login.cfg file located at /etc/security/login.cfg. This attribute is utilized by the chsh command to determine the available shell options ...
medisamm's user avatar
  • 111
1 vote

change shell to /usr/bin/false in IBM aix os

Available shells are listed in /etc/shells. You most probably only need to add /usr/bin/false there.
Gerald Schneider's user avatar
1 vote

Shell script capturing values from output of command

Something like in awk can do the work: packet_lost=$(ping -c4 8.8.8.8|awk '/packet loss/ {print $6}')
Romeo Ninov's user avatar
  • 5,932
1 vote

Shell script capturing values from output of command

You can use grep and awk to capture the packet loss from the output of the ping command. Here's an example: ping_result=$(ping -c4 8.8.8.8) packet_loss=$(echo "$ping_result" | grep -oP '\d+% ...
OscarG's user avatar
  • 26
1 vote
Accepted

Why executable files (mode x flagged) under a folder cannot run?

Quote from man mount: user Allow an ordinary user to mount the filesystem. The name of the mounting user is written to mtab so that he can unmount the filesystem again. This option implies the ...
Gerald Schneider's user avatar
1 vote

Why doesn't systemd capture output from subprocesses of a user service written in shell script?

While I haven't investigated the underlying technical details, the same solution that works for Python (disable buffering) also works in this situation. If I use this unit file... [Unit] Description=...
larsks's user avatar
  • 44.9k
1 vote

Linux: Run a specific command as another user?

I want to be able to allow users to run a specific command as another user, is this possible? Yes That is what the sudo command is designed for. Although many novice Linux sysadmins only know and use ...
HBruijn's user avatar
  • 80.3k
1 vote
Accepted

Extract Pages from Various PDF Files into New PDF File

With poppler utils pdfseparate and pdfunite: #! /usr/bin/env bash input_filename_1="a.pdf" input_filename_2="b.pdf" input_filename_3="c.pdf" output_filename="of....
Arnaud Valmary's user avatar
1 vote

Any way to see output of pv when run in subshell?

Why not use the native dd progress counter ; the status=progress flag? dd if=/dev/sda bs=4M status=progress which should show periodic updates like: 2051014656 bytes (2.1 GB) copied, 15.602310 s, ...
HBruijn's user avatar
  • 80.3k
1 vote

How to create .env multiline variable

You can do something like this: MY_ENV_VAR=$(cat <<EOF line 1 line 2 line 3 EOF ) Be aware that "EOF" needs to be in its own line, nothing after or before, so you need to close the ...
Xiromoreira's user avatar
1 vote
Accepted

Command that run fine... but give me an error when "piped" to grep, inside a docker RUN?

You can try disabling the usage of ANSI escape codes for output formatting by adding the --no-ansi option to the composer run-script --list command. This can occasionally fix output-related problems ...
Hawshemi's user avatar
  • 296
1 vote
Accepted

Cleaning up WordPress thumbnails; trying to find all thumbnails and delete them on Ubuntu 22

What I would do: $ ls -1 apple-touch-icon-magnifier-256x256.png favicon-magnifier-256x256.png seo-magnifier-256x256.png $ find . -regextype egrep \ -not -regex '.*/(favicon|apple-touch-icon|...
Gilles Quénot's user avatar
1 vote
Accepted

zsh completion ( compctl ) does not trig for command names containing dashes

Got it confirmed in the [email protected] mailing-list that this is a bug and got a suggested patch: --- zsh-5.9.orig/Src/Zle/zle_tricky.c +++ zsh-5.9/Src/Zle/zle_tricky.c @@ -1315,6 +1315,8 @@ ...
fraxflax's user avatar
1 vote

how to make a shell execute with suid

While shell programs deliberately don't do what you want, you could create your own program that does. This is an example program that will check if you have euid root, and if so, run a specific ...
Jonathan Beverley's user avatar
1 vote

Why can't I capture AWS EC2 CLI Output in Bash?

I faced this issue as well when I tried to insert an ACW CLI output into a variable. What I did to overcome this issue was: token=$(aws <command> | jq -r '.NextToken') echo $token
user1033776's user avatar
1 vote

How can I display the IP address of an interface?

ip addr show dev eth0 if you want to see all addresses for one interface
bryvo01's user avatar
  • 11

Only top scored, non community-wiki answers of a minimum length are eligible