Solved

Remove sudo

Posted on 2014-03-07
6
386 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 29

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 30

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 30

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
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 several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

631 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