Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [shell]

A shell is terminology for a command-line interpreter most commonly used with Unix-like operating systems, but also used to interact with GUI-based operating systems in a more granular fashion. Not only does it allows the user to run programs from a text interface, but frequently offers basic ...

1
vote
0answers
23 views

Create a screen. Run said screen as a user. Detach

I'm essentially trying to combo Create screen and run command without attaching and another answer that allowed me to run a script as another user. I want to SSH from Server 1 -> Server 2 and run a ...
0
votes
1answer
32 views

Shell - if conditions match, run code every x seconds for certain amount of time or certain number of times

I have a shell script I am working on that monitors something and currently runs in the terminal showing the output if a condition matches. If there is a match I want it to run a block of code every x ...
-3
votes
1answer
17 views

bash ftp change directory on remote server

I have a shell script that FTPs some non-sensitive data to a remote server. However, I would like to set the remote path rather than just use the remote FTP user's default path. I have searched for ...
0
votes
0answers
11 views

Why sed gives different result in script and in terminal?

CALL_TOKEN=`echo "$1" | sed -e 's/[^a-Z0-9]*//g'` fn_debug "First element: $1" fn_debug "CALL_TOKEN: $CALL_TOKEN" Why CALL_TOKEN is an empty string? If I run same commands on the same server ...
-1
votes
0answers
16 views

VPS on Linux: why the need to use text shell [duplicate]

I'm new to Linux and VPSs. I'm reading tutorials on how to set up your own VPS after buying it from a hoster and each seems to focus on the shell commands. But why doesn't Linux have a GUI, like ...
-1
votes
1answer
24 views

Command that returns exit code still returning 0 when using “command 2>&1 | tee -a /var/log/file.log”

I'm running a script that executes a command and save the output to a file in /var/log. After that, it gets the exit code and execute another command based on an if/else condition. The problem is: 2>&...
0
votes
2answers
37 views

How to find file and combine `find … -exec` and echo empty string to it?

I want to echo empty to such file types, for example: bash-3.2$ cat t1.txt aa bash-3.2$ cat t2.txt aa bash-3.2$ cat t3.txt aa I've tried to make them empty by: $ find /Users/liweijian/Downloads/...
0
votes
2answers
53 views

Bash function doesn't work for remote ssh command execution although interactive shell function fine

I define a function in .bash_aliases file and include it in my .bashrc file. My .bash_aliases file: function dmidecode() { if [[ $1 == -t && $2 == 1 ]]; then cat ~/...
0
votes
1answer
19 views

Can GNU screen leave you at shell prompt after command instead of exiting the TTY?

I commonly need to run a specific screen session with 9-10 windows, most of which need to run either an interactive command, or simply a setup-type of command. I do this via screen -c <config-that-...
0
votes
1answer
40 views

FTP PAM Setup for VSFTPD

OK. I know this is one of the most asked questions here. But most answers are either telling me to add nologin to allowed shells (nope... not doing that) or disabling SELinux (which i don't have - ...
0
votes
3answers
140 views

Allowing SSH To use ssh-agent in bash script

I am working on recon for a set of systems my company is taking over and they use a different authentication method than we do. Specifically we use AD auth and a jump server to access systems where ...
0
votes
2answers
53 views

If run as a cronjob my shell script doesn't launch a screen

Please have a look at the following simple shell script startCleanup.sh: #!/bin/sh screen -d -m -S cleaner /usr/bin/python3 /opt/cleanup.py My crontab looks like this: * * * * * /opt/startCleanup....
0
votes
0answers
16 views

What is the “shell>” on SuperMicro?

I tried to replace two failing disks on a SuperMicro server, and now the boot process does not finish, and I'm left in a shell> prompt. Anyone knows what is the software that produces the shell>...
0
votes
1answer
102 views

Jenkins - environment variable not setting up from pipeline

Here is my script. Im trying to set up variables in pipline shell script: node { anyconnect = docker.image('anyconnect:1').run("--cap-add NET_ADMIN --cap-add SYS_ADMIN --device /dev/net/tun:/dev/...
2
votes
1answer
107 views

Ctrl+C no longer working to get a new blank line in bash

I have been using Ctrl+C on most terminals to easily cancel the line I was writing and open the way for a new line. (I'm not talking about killing a running bash script, but just opening a new blank ...
1
vote
2answers
110 views

Bash script as use shell not working with SSH

I'm trying to use a specific bash script as a user shell. So that if the user logs in, the script will be executed. I've created the script and placed it into the home directory for the specific user....
0
votes
0answers
81 views

CircleCI deploy to AWS EC2

I have/want a workflow like so: Push branch to Bitbucket Pull request branch into Master in Bitbucket This triggers CircleCI to do a build CircleCI deploys the successful build to AWS EC2 instance I ...
1
vote
1answer
23 views

Execute actions after specific commands in Apache Guacamole SSH

I setup Apache Guacamole 0.9.14 on my CentOS 7 with nginx as reverse proxy to it. I want to give limited access to some of my employees for some of my servers via ssh. Some of them are SFTP enabled ...
0
votes
1answer
37 views

Bash SFTP Script - Too many login attempts looks like a DOS attack

I've managed to write a bash script, based on someone's previous work, to send out files via SFTP to a Limoma GoAnywhere application. I'm not fluent in bash or shell. Unfortunately, the GoAnywhere ...
0
votes
1answer
70 views

Issue to get Cookie: JSESSIONID and auth_cookie

I wanted to execute one API using the command line but need to pass Cookie: JSESSIONID=<>; auth_cookie=<> value while executing it. We have CAS authentication for the target API. Please let me ...
0
votes
1answer
31 views

Reroute IP to different IP, but there is a catch

This is not the normal reroute IP through iptables but it is a bit more complicated. I am using a very stripped down version of Busybox. The version has dropbear installed only a few limitations. It ...
0
votes
1answer
51 views

Defining array in shell script

I am trying to define array in my shell script which would have content like below cassandra_hosts=(cassandra1.test-dev.local cassandra2.test-dev.local cassandra3.test-dev.local) But it doesn't let ...
0
votes
1answer
91 views

Grep returns nothing

This is the grep command I used grep -ic address log* The output is 0. I know for a fact that there are more than 60 occurrences of the word address in the log file. But I still get 0. Now, I ...
0
votes
0answers
31 views

How can I distinguish between production and development terminal tabs?

Today I almost entered a command into a production database console, thinking it was my local one. Is there a good way to prevent this mistake from happening? My first thought was to make the UI ...
0
votes
0answers
55 views

Is there a shell which only runs scripts interactively or as an executable?

Instead of a restricted shell where, operations are forbidden, are there any largely bourne-compatible shells, or modifications thereof where the number of ways to get them to run a script has been ...
0
votes
0answers
58 views

Pass shell script to cygwin ssh from mac with arguments

How can I run a shell script from mac on a Windows openssh installation and pass arguments? This is what I currently have: ( cat run.sh ) | ssh -t user@host How can I modify this to pass arguments ...
1
vote
3answers
43 views

Sed or other script, and regexp solution for cutting a filename

What I need is to get 2-3 variable from filenames. I use: FILES=$(ls -tr .../Files/) for f in $FILES; do ...... The files look like this: [letters and/or numbers and (underscore or nothing)][6 ...
0
votes
1answer
53 views

rsync - on uncleaned shell and connection unexpectedly closed

I want to run rync to a remote server which has an uncleaned shell. If someone tries to connect it via ssh shell, it'll show some warnings. Due to this issue I couldn't able to copy files. protocol ...
0
votes
1answer
24 views

Pipe filenames onto Rubocop

I'm trying to pipe filnames into Rubocop as such: $ git diff --name-only | tr '\n' ' ' | rubocop However Rubocop still checks all project files. Is there something wrong on my piping? On Rubocop? ...
-2
votes
1answer
23 views

sed search and add some sting

======KVM 虚拟化手册====== =====简介===== =====安装和配置kvm虚拟化===== ====检查是否支持KVM==== ====安装kvm虚拟化平台==== ====配置nested virtualization==== ==== 配置网络==== ====重启系统并检查相关配置==== =====virsh创建 & 安装虚拟机===== ====...
0
votes
1answer
449 views

ansible-playbook doesn't work inside a bash script

I am not sure what is going on and hence I enquiring here as well in hopes that some of you might. I am trying to figure out why the same one-liner will successfully connect on my remote server ...
0
votes
0answers
25 views

Shell provisioner in Packer cannot set the default boot option in grubenv after installing a new kernel

I'm using Packer to build some CentOS 7 VM's. A part of this process is installing Linux Kernel ver. 4.15. Installing the Kernel has been pretty straightforward but getting the VM to recognize the new ...
-1
votes
3answers
824 views

Bash script: save last line output from terminal

I am writing a bash script in which I would like to save the output of the last command in to a variable before running my next one so I can display it later. I have tried a few different methods ...
0
votes
0answers
45 views

linux sh -c replace echo not working

This seems like it should have a super simple answer, but I have search for a while and tried different suggestions to no avail. As an example, I am trying to create a function that will be available ...
0
votes
3answers
791 views

Execute local bash scripts on remote server but needs user input

I am using SSH command to execute the bash scripts remotely: ssh user@server 'bash -s' < $script_dir/script.sh And inside the script.sh, I will have the command like below to add ssh keys: ssh-...
1
vote
1answer
46 views

Can auditd logs be modified? (Security, shell monitoring)

I recently set up auditd and enabled TTY logging so I could give someone non-root shell access and monitor what they're doing. (For what it's worth I gave them jailshell access, a cPanel feature that ...
0
votes
1answer
34 views

Why is this shell command always returning 1?

Here is a shell puzzle I can't answer (bash). This returns exit code 1: ping $HOSTNAME -c2 -W2 2&>1 > /dev/null This returns the correct exit code every time (2, 1 or 0). ping $HOSTNAME -...
-2
votes
2answers
61 views

Shell script to enumerate the (already existing) LDAP group called “VPN Users”

I am new to LDAP and learning about the ldapsearch and ldap in general. Would like to write a shell script that enumerate the (already existing) LDAP group "VPN Users", then get all user "...
-1
votes
1answer
116 views

How to pass variable into bash script and use seperate variables with awk?

I have a script that I am using to clear out all lines of a log files older than X days. X can be passed in via command line as well as the log file name, ex usage: ./purge-catalina.sh 3 /opt/...
0
votes
0answers
41 views

Starting script at FTP user login

i got a problem with my desired ftp solution. i run a vsftp server on Debian and connecting with FTP over TLS. all allowed users are jailed in a chroot after login. Now i want to mount different ...
0
votes
2answers
53 views

Use variables in paths in crontab

The crontab I use is more complex but I broke the problem down to a minimal problem set. My crontab is working like this: mypath='/home/user/opt/script_home' myscript='/home/user/opt/script_home/...
0
votes
2answers
47 views

How to make a shell script return 0 even after getting killed

I have a scheduled shell script running in a distributed environment. There are some scenarios where the process might get killed by some other processes. But I need the process to return 0 even after ...
0
votes
1answer
73 views

Running tcsh scripts on startup in bash env

I have a user called foo which is using tcsh by default in /etc/passwd. I cannot change that default shell. Foo has a service called xyz running, for which all the startup scripts and .(dot) file ...
0
votes
2answers
51 views

Exclude certain disk in dd command script for disk erasure

for disk in $(lspv | awk '{print $1}') ; do dd if=/dev/zero of=/dev/${disk} bs=1024 count=$(bootinfo -s ${disk}) echo $disk wiped done How do i exclude certain disks like hdisk0,hdisk1 and ...
1
vote
0answers
35 views

AIX server DOD method for secure erase disk [duplicate]

I would like to know how can i securely erase disk on AIX as per DOD standards? any utility i can download and use on aix server rather using regular dd or diag command? Appreciate your help! ...
1
vote
2answers
196 views

Files uploaded using SFTP does not have the correct rights

I have a weird issue when trying to upload files to a server using SFTP. When for maximum security I use a user with a disabled shell ("/bin/false") to upload files, I get mode 640 for the uploaded ...
-1
votes
1answer
932 views

No such file or directory linux shell script

#!/bin/bash mysql -uroot -pwelcome1 < /home/sai/first.sql echo "The program has completed" I am trying to call a sql file from shell script ,I am running the script as bash run.sh, but it telling ...
0
votes
4answers
415 views

How can I run select commands on multiple servers from a shell script?

How can I execute scripts from arguments on multiple servers? I'm trying to build a command list, and then execute commands on each server. I'm unable to generate the command list in a way that can ...
-1
votes
1answer
55 views

Checking if a programm is running on linux

i'm trying to check if a program on a linux server is running and start it if not. But i get strange errors: #!/bin/sh SERVICE=nrpe ps -ef | grep -v grep | grep $SERVICE | wc -l if [ $? -gt 1 ] ...
0
votes
1answer
35 views

Linux - Limit user to one application in ssh

This is something that I looked into a while back and found some useful info for... but now that I actually need to do it, of course I can't find that guide I saw anymore. Anyways, here's the ...