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 programming features such as variables, substitution, output redirection, and wildcards.

0
votes
0answers
17 views

Screen terminal replaces some characters with question marks? (ä ö ü ß § °)

I know if this is important, but I'm running a Minecraft server in a screen on my VPS. Everthing was working just fine two days ago, but then I resetted my machine yesterday (same OS as before, Ubuntu ...
-1
votes
0answers
23 views

Reverse shell on a closed port possible?

Recently my website was hacked. Luckily the hacker did not have any bad intentions and even left contact information. I contacted him to ask how he did it and he told me he create a reverse shell. I ...
0
votes
0answers
17 views

Get ESSID & BSSID of open networks in Terminal

I'm looking for a way to get BSSID and ESSID of all open (not encrypted) wireless networks in my surroundings with a bash command. It would be even better, if could filter out networks with a too low ...
2
votes
2answers
83 views

Achieving very fast (300+MB/sec) file transfer on Linux

I'm working with high end hardware, however I'm hitting cpu bottlenecks in all situations when attempting to move large amounts of data. Specifically, I'm moving large virtual machine image (VHD) ...
0
votes
0answers
22 views

Routing trafffic from vpn tunnel source to other interface

We have five interfaces in the server. I would like to route traffic from IP 10.8.0.150 behind tun0 to 10.130.219.68 behind interface em2. I have enabled port forwarding and done IP tables rules ...
0
votes
0answers
13 views

How to recovery shell access from root?

I was configuring FTP server on CentOS 7 (doing some steps from here Create new vsftpd user and lock to (specify) home / login directory) and I lost the access to ssh bash with root and I have no ...
0
votes
1answer
43 views

How to start a jar file using systemd

I want to start java application on system boot using systemd. I tried to do by adding above scripts. But service is not starting. my-startup.service [Unit] Description=Startup [Service] ExecStart=...
1
vote
3answers
85 views

How to fix a tmux session messed up by control characters

Every once in awhile, I'll accidentally blast some control codes into my terminal session (either errant coding or accidentally gpg --export). This sometimes causes my tmux session to loose it's ...
1
vote
0answers
46 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 ...
-3
votes
1answer
55 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
14 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
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
41 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
70 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
137 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
254 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
59 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
19 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
442 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
159 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
131 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
138 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
31 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
55 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
150 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
36 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
52 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
99 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
33 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
67 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
79 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
33 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
25 views

sed search and add some sting

======KVM 虚拟化手册====== =====简介===== =====安装和配置kvm虚拟化===== ====检查是否支持KVM==== ====安装kvm虚拟化平台==== ====配置nested virtualization==== ==== 配置网络==== ====重启系统并检查相关配置==== =====virsh创建 & 安装虚拟机===== ====...
0
votes
1answer
527 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
44 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
1k 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
57 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
1k 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
52 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
35 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
75 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
140 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
53 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
68 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
50 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
83 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
54 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 ...