Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Remove sudo

Posted on 2014-03-07
6
Medium Priority
?
389 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 2000 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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

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…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

664 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