Solved

Remove sudo

Posted on 2014-03-07
6
365 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 27

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 27

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

708 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

13 Experts available now in Live!

Get 1:1 Help Now