Questions tagged [bash]

Bash is the Bourne Again SHell, the successor to the classic Unix sh (shell).

bash is the Bourne Again SHell, the successor to the classic Unix Bourne shell (sh). It's the default shell on many Linux distributions, including RedHat, CentOS, Debian, and Ubuntu.

The premier online guide is the BashGuide.

3527 questions
1
vote
0 answers

How to tell screen use use different bash_profile?

How can I tell to screen to use different bash_profile? Problem is we use a technical user to log in, but I edited a custom PS1. Normally I login with putty like: ssh user@host -t "bash --rcfile ~/.profile.custom -i" But screen use the default…
1
vote
3 answers

I want the bash script to echo only if I execute and not echo if executed by a cron job

I want to echo to the terminal if the script is being executed by me, in the flesh or I want to echo to a log file if it is being done via a cron job. Ubuntu 16.04 example: #!/bin/bash if [ ***** ]; then echo "You executed this script just now…
Vituvo
  • 337
  • 2
  • 5
  • 16
1
vote
1 answer

allow all users to execute a bash script as root

i want that my all users can run a bash script. But this bash script need to have root right, i want that this script is in read only and run with root right my bash script : #!/bin/bash /sbin/swapoff -a in my search i found solution but it not…
rori
  • 11
  • 2
1
vote
1 answer

SSH Connection ask password for postgres user

I would like to get $PGDATA from server with SSH connection under postgres user but I have some issues: ssh postgres@myServer postgres@myServer's password: But I don't know the password and I don't want to use it or know it... So I tried something…
Carlinto
  • 31
  • 1
  • 3
1
vote
1 answer

ps sniffing on mysql password

I am passing the password to a mysql connection via a script using : mysql -u root -p'mypass' so I can execute task on that line using --execute. I have seen in many stackexchange forums that passing password through command line is highly not…
1
vote
1 answer

How to test Remote host Identification for changes without ssh

I have a script which runs and makes the assumption that the remote host key is in known_hosts when running some commands which use SSH. I would like to know if there is some command that can be ran that will output the remote host key status before…
Justin
  • 113
  • 2
1
vote
0 answers

Aliases defined at login don't seem to work with sudo

I'd like to define some global aliases which would be available for everyone on a mult-user linux system (git shortcuts, etc). It seems I have two options avaialable; either place these aliases in (something like) /etc/profile.d/aliases_for_all or…
Server Fault
  • 3,714
  • 12
  • 54
  • 89
1
vote
2 answers

Executing local bash script remotely, interactively, with arguments

From all of my testing it seems like it is not possible to execute a local script remotely while allowing an interactive shell and passing arguments. Interactive (arguments try to run as a seperate command either inside or outside the double…
Jesse
  • 121
  • 6
1
vote
4 answers

Securing bash scripts

Does anybody know what is the best way to secure bash scripts. I have a script which creates database and source code backup and ftp it to other server. And login/password for destination ftp are plain text. I need somehow encrypt it or hide it in…
minnur
  • 115
  • 7
1
vote
2 answers

Can different scripts share a lockfile to ensure they don't interfere with each other?

I've used flock a lot in the past to ensure that a process only spawns once (in case it gets hung up/etc) but I've never used it for two different processes. In this scenario two different scripts affect the same "temp" directory (the dir is…
emmdee
  • 2,187
  • 12
  • 36
  • 60
1
vote
2 answers

shasum of tar file different on os x / ubuntu although files are identical

I have a problem that brings me to despair and is plaguing me for the last days and I hope somebody can give me a hint what I have overlooked, since bash/sh is not a field I work in everyday: Scenario: I have a project developed in OS X 10.11.6,…
hreimer
  • 181
  • 1
  • 2
  • 10
1
vote
1 answer

How to write and read from the same file using two netcats?

I'd like to use a file as a temporary buffer to connect two netcat processes. I need to use a buffer because data is sent and requested on each end at different intervals. I want to use a file instead of an actual mkfifo buffer because the data will…
skyler
  • 465
  • 3
  • 8
  • 17
1
vote
1 answer

How can I apply "shopt -s extdebug" to my shell by default?

I am trying to build a pre-exec checker in bash (using bash-preexec.sh) In order to fail the command when the pre-exec hook fails, I need to run shopt -s extdebug (which fails the command when trap DEBUG command returns non-zero RC). If I run shopt…
DVK
  • 151
  • 8
1
vote
1 answer

adding string & variable to another variable in bash script

I've tried to create a bash script to show all available local IP addresses. Since the normal ping option can't go quicker than 1 second per IP address and fping shows too much output when executed in a for loop, I tried to do it like this: read -p…
user450947
1
vote
0 answers

ERROR: 500048: Inappropriate authentication when running adtool to retrieve a user's attributes

I have an Ubuntu server that is joined to an AD domain via PBIS-Open I am running a query using adtool (/opt/pbis/bin/adtool) to query for a user's attribute. The problem is that whenever I run this command with any system user, I keep receiving…