Solved

Remove sudo

Posted on 2014-03-07
6
371 Views
Last Modified: 2014-03-29
Ive built myself a little ubuntu server which works great, my only problem is editing config files.

I want to be able to edit files via winscp remotely, however when I try and save back I get 'access denied'. The only way Ive been able to edit the files is to use putty and then edit the files as sudo like "sudo nano /etc/apache2/httpd.conf".

Is it possible to take ownership of the entire server as my username so I can edit the files as I want without sudo through winscp, or through putty but without sudo?

Thank you in advance
0
Comment
Question by:tonelm54
6 Comments
 
LVL 28

Expert Comment

by:Jan Springer
ID: 39913615
sudo su

you'll be asked for your password and at that point you're operating as root.
0
 
LVL 28

Accepted Solution

by:
serialband earned 500 total points
ID: 39913773
You shouldn't do that, and you shouldn't disable sudo.  It's unnecessary.

Put your key in ~root/.ssh/authorized_keys if your sshd.conf doesn't block root.  The default ubuntu just prevents password access to root not ssh key access.  From the context, I'm assuming you're using ubuntu or it's variant, since you're talking about sudo.  They only blank the root password in /etc/shadow, but not actually restrict root from ssh access.  Don't set a password, because that allows for man-in-the-middle attacks.  That's been the default for quite some time on ubuntu.

Since you're using winscp & putty, you should learn to use pagent.exe to load and store your passphrased key to simplify your putty and winscp connections.  pagent is one of the tools included in putty.zip.

sudo su works, but sudo -s is the way to obtain sudo shell access.  You could technically restrict the su and bash commands, but still access the shell.  By default, ubuntu "admin" accounts have full sudo access.
0
 

Author Comment

by:tonelm54
ID: 39914347
My attemp here is to edit config files remotely and using nano isn't the easiest to use through putty. I thought editing the files through winscp would be easiest, however when editing I just get access denied when saving the files back.

I've never even heard of pageant, but from my understanding it's just used to store keys for connections which isn't my problem. I can connect fine to the server, it's just editing the files I'm stuck with :-(
0
 
LVL 48

Expert Comment

by:Tintin
ID: 39914466
In order to do what you want, you'll need to connect via WinSCP with the 'root' user.
0
 
LVL 28

Expert Comment

by:serialband
ID: 39915256
You use pagent to load the ssh key to connect to the root account.  To prevent man-in-the-middle attacks, you shouldn't use passwords for root.  Use ssh keys.  When you have the key in pagent, you can connect as root and edit/copy files with root permission.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now