I just installed Ubuntu Server 22.04 and SSHed in. I'm not able to paste multiple sudo commands as I could with Ubuntu Server 20.04. This feels to me like a security feature that I don't want.
Previously (before 22.04) I could manually enter sudo -v
and then paste some sudo
commands and I'd get:
user@host:~$ sudo -v
[sudo] password for user:
user@host:~$ sudo mkdir test
user@host:~$ sudo rm -r test
user@host:~$ ls
user@host:~$
Now, with 22.04, I get:
user@host:~$ sudo -v
[sudo] password for user:
user@host:~$ sudo mkdir test
sudo rm -r test
user@host:~$ ls
test
How can I change this behavior?
Edit:
After trying what's suggested in this answer, I still get the same results. I did try pasting a second time after doing bind 'set enable-bracketed-paste off'
.
user@host:~$ sudo -v
user@host:~$ bind 'set enable-bracketed-paste off'
user@host:~$ bind -v | grep bracketed
set enable-bracketed-paste off
user@host:~$ sudo -v
user@host:~$ sudo mkdir test
sudo rm -r test
user@host:~$ ls
test
user@host:~$
Edit 2:
I also ran xterm
via ssh
and X forwarding from my Mac and got the same results as a regular ssh
connection.
sudo
, why not usesudo -i
and then just enter the commands into root shell without prefixing them withsudo
? Why do you want to prefix each command separately withsudo
?