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

learn more… | top users | synonyms (1)

68
votes
6answers
41k views

How to test if my server is vulnerable to the ShellShock bug?

How can I ensure my Bash installation is not vulnerable to the ShellShock bug anymore after the updates?
5
votes
7answers
10k views

What is a recommended way to patch the Shellshock Bash bug on an unsupported Ubuntu server?

I maintain an out-of-support Ubuntu Quantal server (12.10), don't ask me why please, and we need to patch the Shellshock Bash security bug. As upgrades are not available anymore, what is the ...
3
votes
2answers
7k views

Yum reports updated bash but binary still reports old version

I'm trying to update a CentOS 5 system in order to patch the bash vulnerability described in CVE-2014-6271 / RHSA-2014:1293-1, but am running into an issue. After seemingly-successfully updating bash ...
16
votes
4answers
19k views

How do I patch RHEL 4 for the bash vulnerabilities in CVE-2014-6271 and CVE-2014-7169?

A mechanism for remote code execution through Bash has been widely reported yesterday and today (September 24, 2014.) http://seclists.org/oss-sec/2014/q3/650 Reported as CVE-2014-7169 or CVE-2014-6271 ...
2
votes
1answer
59 views

Performing root mysql operations in bash scripts

What is a good practice to execute root operations on mysql databases in bash scripts? For example, I want to create new database and grant privileges, I have to use: mysql -u $ROOT -p"$ROOTPASS" -e ...
0
votes
0answers
42 views

7z from bash script won't exclude directories [migrated]

I've encountered with kinda strange behaviour of 7z (or bash, I don't know yet.). With the following script: #!/bin/bash find /home/user -type f -name "*.pdf" | cut -c 10- > ...
0
votes
1answer
45 views

Cronjob for a bash script pauses for 2 minutes randomly

I have been running a bash script on CEntOS 5.5 machine that checks replication on a remote mysql server. The script creates a temporary lock file and is scheduled to run in Crontab every minute. But ...
-1
votes
2answers
32 views

Getting Java Version in bash script results are blank [closed]

I've got a bash script that grabs a bunch of environment data, part of that grabs the JDK location on a Unix machine and then runs the version check. It works on some Machines but not others for some ...
0
votes
1answer
26 views

Timeout a script with stdin

I need something like this: timeout -k 4 cat file | myscript.sh but i get this error: timeout: invalid time interval ‘cat’ Try 'timeout --help' for more information. I want to pass stdin to ...
0
votes
2answers
41 views

Linux `file` command display encoding

The file command returns me the encoding of a file + the EOL if it's not LF. But it returns ASCII for both ANSI and UTF-8 without BOM. On UTF-8 files it returns UTF-8 Unicode (with BOM). An I doing ...
1
vote
0answers
56 views

Encrypting/Decrypting a file using openssl through an autorun script

So I am trying to encrypt/decrypt a file using openssl. I am running it through a script that is automatically run when I mount a USB, and decrypts the file. However, it doesn't work quite right, so ...
0
votes
1answer
43 views

Unable to redirect STDOUT in a remote screen session via SSH

I would like to execute a long-running command via SSH/screen and have the output redirected to a file. I'm able to run the command fine (similar to this question), but the output never shows up. ...
0
votes
1answer
50 views

insserv: warning: script 'uwsgi' missing LSB tags and overrides

This is my code: #!/bin/bash daemon="$APPVENV/bin/uwsgi" args="--emperor $APPCONF/uwsgi/app.ini" pid="$APPDIR/emperor.pid" case "\$1" in start) echo "Starting uwsgi" ...
0
votes
2answers
59 views

Purposely corrupt folder name?

I want to intentionally corrupt a folder name so I can test a script on it. Currently the folders are named similar to : 37ee0500-52c0-4a18-861e-0084EF05FB and are located in: /user/members/local/ ...
0
votes
3answers
42 views

how to run the dialog command with proccess

Please look on my code – ( bash script ) I want to display both dialogs on the screen on the same time, one dialog display the: tail –f from - /var/log/proccess1.log , and the second dialog ...
0
votes
0answers
29 views

Bash and background processes PGID and receiving signals

My actual problem is that a process I run in an rcfile in docker as docker run container bash --rcfile rcfile remains attached to the bash session by sharing the PGID which means that when I Ctrl-C an ...
-3
votes
1answer
52 views

use bash to open a file and output the last line [closed]

I'm trying to get only the last command ran in a different Bash window. I have the other Bash window's PID. I can run APID=<bash pid number>; gdb -batch --eval "attach $APID" --eval "call ...
-1
votes
0answers
42 views

Copy all folders to a new location except those containing invalid characters [migrated]

The aim is to create a Bash script that copies all folders and files within a folder to a new location. The folder name from where the copying should take place should always match the following ...
0
votes
0answers
30 views

mailx command strange behaviour from cron

I have a script that redirect the df output to a file and then send it in an email. The mail command is set up as following: /usr/bin/mail -s "Subject" -r from@nowhere.com toaddress@somewhere.com ...
1
vote
2answers
92 views

Which open source program is similar to the Linux “dialog” command? [closed]

The linux dialog command is a great tool for creating dialog boxes in terminal windows (e.g. in a bash script). However, there is a drawback of dialog which is that the window is always positioned in ...
0
votes
0answers
35 views

How can I sudo su and change directory just after? [migrated]

I would like to create an alias that does something like this: alias userYYY='sudo su userYYY; cd /a/path/that/only/userYYY/has/access' So then from my command line, I am logged in with a sudoer ...
3
votes
1answer
63 views

How to view two dialog boxes on the linux console, running on the same time?

I want to view on the Linux console two dialog windows on the same time. I want a window that views the progress BAR, and the a second tailbox that view the logs are running. The problem is that the ...
0
votes
0answers
35 views

Non-interactive shell expand alias [migrated]

I'm having trouble getting aliases to expand on my hosting account when I run a command like: ssh user@server "bash -c \"alias\"" My .bashrc file is: echo .bashrc # .bashrc shopt -s ...
0
votes
1answer
17 views

Trouble using ssh-key gen specifying location and password

This is my code: ssh-keygen -t rsa -C "$APP" This works perfectly. However it then asks me to specify location and password. I was hoping I can automate this all in one go, however this command ...
0
votes
2answers
48 views

Generating random passwords with shell on server deployment

I'm trying to generate random and secure passwords to my various configuration files and settings on the fly when I run my automated deployment script. I want them to be generated, shown to the user, ...
0
votes
2answers
78 views

Bash: Execute command from variable without eval

I have a problem with a script which should execute a curl command composed from the given arguments. It works if I use eval in the subshell, however, I would like to avoid that as it seems to be bad ...
-1
votes
1answer
33 views

how can i redirect run program command on different server [closed]

I have 2 server Linux server (RHEL5). Server1 is running X server where users connect to it with VNC/NX and the other one is for running programs. So users don't interrupt to each other, I want to ...
0
votes
1answer
62 views

Background job terminates when run from script, but works fine when run from bash prompt

I'm on MacOS 10.9.4. I want to put sftp to background to automatically push some files to it through named pipe later, as suggested here. It works fine when I enter commands manually from bash prompt ...
0
votes
1answer
132 views

Will this HAProxy “restart script” work as gracefully I think it will?

I put this script together from various places. What I am hoping is that it will do the following once run: Pause all "NEW" http traffic for ports 80 and 443 - just "pause" them, don't give any ...
0
votes
1answer
36 views

init.d script appears to run but dies immediately

I registered the init.d script and when I invoke this directly /etc/init.d/gae it appears to work...PID file is created but the process is no where to be seen by the time I do a ps I have googled and ...
0
votes
4answers
62 views

Redirect HTTPS traffic without changing the HOSTS file

I have a website hosted on 2 servers. The website is SSL based. I'd like to monitor (load the main page and look for a certain string) the website per server using a local Opsview. Meaning I need to ...
0
votes
1answer
61 views

Bash time check script allow 1 minute difference

I am developing a nagios/collectd check for time checking on each server. I have done bash script to get info from Collectd WSP files and check them against the nagios server time (date +%s). Collectd ...
1
vote
1answer
282 views

ip route add works manually but throws “Error: an inet prefix is expected rather than …” when run via bash script

I'm trying to run a script that should add this route to a table 11: ip route add local 10.1.3.212 dev eth1 proto kernel scope host src 10.1.3.212 table 11 If I run this command manually, it is ...
1
vote
2answers
124 views

how to prevent git from using logged in username

I would like to make it possible for any user to clone a repository without having to specify the username in the clone command. For example, say my git username is john.doe (e.g. customer ...
1
vote
1answer
56 views

cURL - download multiple files and specify output names

I have list of URLs with range in {}. I can download them with cURL in bash, but problem is output. I can use #1, but I need to have files named with different names (I have stored those names in ...
-2
votes
2answers
85 views

Cron not launching python script

Python script is not being run, all other functions are running and stand alone script runs but combined... nada. Initially it was */30 * * * * screen python ~/db_preset.py (Yes there was new line ...
33
votes
8answers
3k views

How can I run arbitrarily complex command using sudo over ssh?

I have a system that I can only log in to under my username (myuser), but I need to run commands as other user (scriptuser). So far, I have come up with the following to run the commands I need: ssh ...
0
votes
2answers
48 views

Bash Script keeps respawning after it should die

#!/bin/bash PID=$(pidof daemon) kill $PID while ps -e | grep "[d]aemon" >> /dev/null; do sleep 30 done sh -c /root/daemon This script is set on a cronjob to kill and restart this program. It ...
0
votes
0answers
13 views

pipe rrd to a new directory

I am chrooted and running out of drive space, so I mounted back to the host drive which has plenty of space but cannot seem to pipe the outputted data to my empty drive [root@localhost rra]# ls ...
1
vote
1answer
35 views

crontab truncates file path

I try to run the following command: crontab -u root /root/iss/current/node/bin/installers/nl_brandless_selector_full_hd/nl_brandless_selector_full_hd_cron_file But I got an error like this: ...
0
votes
0answers
26 views

different interactive and non-interactive shells

A user account has it's shell defined in passwd file as bash. I would like to change this user account's shell to tcsh for non-interactive jobs (like ssh ), but keep interactive shell to bash. Is ...
1
vote
2answers
173 views

Linux/Bash: Test if my server is opened to the Internet programmatically/via CLI [closed]

RHEL 6 and Bash. It would be easy if I had a remote server to just run nmap from, or even curl/wget, but I only have access to servers on our side of the firewall. I know I can manually check ...
0
votes
1answer
345 views

CentOS 6.5 proxy bypass/no_proxy not working

I am running CentOS 6.5 on my desktop. I've set the Network Proxy using the network proxy application provided under Preferences. I've also set the following exceptions: ...
0
votes
2answers
83 views

Run Bash Script Another Server

I want to run command one by one, for change the names of the directories on the server. When I run script, directories renamed in server 1. But, directories are not found in server 2. What the ...
-1
votes
3answers
106 views

Can't pipe echo to netcat?

I have the following command: echo 'HTTP/1.1 200 OK\r\n' | nc -l -p 8000 -c and when I curl localhost:8000 I am not seeing HTTP/1.1 200 .. being printed. I am on mac os x with netcat 0.7.1 Any ...
1
vote
2answers
57 views

Kill all currently running cron jobs

For some reason my cron job scripts aren't exiting cleanly and they're backing up my server. There are currently a couple hundred processes running for one of my users. I can use the following command ...
1
vote
2answers
68 views

script to count the occurence of the particular string in the given time interval

We are trying to write a script "sendemail.sh" to count the number of occurrence of a particular string in a log file "SendEmail.log" within the given interval. We have a log file. In that we are ...
-2
votes
1answer
202 views

Bash Script to Compress / Transfer / Remove Log Files [closed]

I am currently using chronolog to set log file names for Apache with date. They are in the following format: /WEB/LOGS/APACHE_ACCESS_YYYY-MM-DD.log /WEB/LOGS/APACHE_ERROR_YYYY-MM-DD.log I would ...
-2
votes
1answer
62 views

Ubuntu Server running Plesk subversion command only accessible to root user

I have a VPS through myhosting.com the VPS is running Ubuntu 12.04.5 LTS with Plesk 12.x when I log into my VPS with the root user and do svn help I get the standard reply telling me the basics of the ...
3
votes
2answers
223 views

Bash convert character in variable

I am writing a collectd nagios custom check script in bash. The problem I am having is that nagios shows hostnames as host.name.domain but collectd holds WSP files as host_name_domain. My question is ...