2

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.

aswine
  • 227

2 Answers2

1

It's due to the addition of Defaults use_pty in /etc/sudoers, comment out the line to revert to the previous behaviour.

sudo
  • 11
0

Why not trying with

user@host:~$ sudo bash

and then write all your commands?