Problems arise when trying to run sudo echo

SAmsonIsThaBest

New Member
Joined
Jun 21, 2021
Messages
2
Reaction score
1
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!
 


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.
 
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!
 

Members online


Latest posts

Top