Problems arise when trying to run sudo echo

SAmsonIsThaBest

New Member
Credits
23
Hey, so basically I am trying to run

echo "deb http://ppa.launchpad.net/linuxuprising/java/ubuntu focal main" | tee /etc/apt/sources.list.d/linuxuprising-java.list

but since I cant remember my root password and this is a remote server I can only use sudo. My account has full root properties but still I get the error: Permission denied. So far I've tried:

running
sudo echo "deb http://ppa.launchpad.net/linuxuprising/java/ubuntu focal main" | tee /etc/apt/sources.list.d/linuxuprising-java.list

running
sudo echo "deb http://ppa.launchpad.net/linuxuprising/java/ubuntu focal main" | sudo tee /etc/apt/sources.list.d/linuxuprising-java.list

running
sudo echo "deb http://ppa.launchpad.net/linuxuprising/java/ubuntu focal main"
and then
sudo tee /etc/apt/sources.list.d/linuxuprising-java.list

this is a big problem for me, pls help!
 


JasKinasis

Well-Known Member
Credits
6,988
I haven’t used ssh for a long time, but I think the following should work:
In the terminal running your ssh session, run the command sudo bash

Then you’ll be prompted for your password.
If you’re ssh’d into a remote machine, you will need to enter your password for the account you’re logged into on the remote pc, not your password for your account on your local machine.

That should open a new instance of bash in the current terminal window, running as root on the remote machine. Then issue your echo commands.
When you’re finished, use ctrl + d or type exit to end the root bash session, and you should be back in the non-root bash shell you were originally ssh’d into.
 

SAmsonIsThaBest

New Member
Credits
23
I haven’t used ssh for a long time, but I think the following should work:
In the terminal running your ssh session, run the command sudo bash

Then you’ll be prompted for your password.
If you’re ssh’d into a remote machine, you will need to enter your password for the account you’re logged into on the remote pc, not your password for your account on your local machine.

That should open a new instance of bash in the current terminal window, running as root on the remote machine. Then issue your echo commands.
When you’re finished, use ctrl + d or type exit to end the root bash session, and you should be back in the non-root bash shell you were originally ssh’d into.
Ah that fixed it thanks!
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!


Latest posts

Top