LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-23-2010, 05:38 AM   #1
Joe of Loath
Member
 
Registered: Dec 2009
Location: Bristol, UK
Distribution: Ubuntu, Debian, Arch.
Posts: 152

Rep: Reputation: 28
Backdoor to server?


Hi there

I have a Debian VPS webserver running a forum, and I'm currently looking for a secondary tech-admin. Since they'll have to have the root password for the server, I'm looking for a way to create a backdoor account that I can use to get in if they divulge the root password, or go crazy and lock me out.

Is there a way to do it?

Thanks!
Joe.
 
Old 11-23-2010, 06:00 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Do you have physical access to the server?
 
1 members found this post helpful.
Old 11-23-2010, 06:03 AM   #3
Joe of Loath
Member
 
Registered: Dec 2009
Location: Bristol, UK
Distribution: Ubuntu, Debian, Arch.
Posts: 152

Original Poster
Rep: Reputation: 28
No, it's a VPS on another continent
 
Old 11-23-2010, 07:13 AM   #4
redgoblin
Member
 
Registered: Jun 2005
Location: UK
Distribution: Debian
Posts: 189

Rep: Reputation: 41
Work out what it is you want them to be able to do and then set that up with the sudo command. As time goes on you can add more commands with root privileges as needs be.

Sudo also gives you the added bonus of logging all the privileged commands that get executed.

Personally if you can't 100% trust someone don't give them root access.
 
3 members found this post helpful.
Old 11-23-2010, 07:42 AM   #5
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
catkin asks the right 1st question.

The only thing that trumps root is physical access. You want an acct. that can do everything root can do, except change the root password. I think your choices are:
  1. trust your appointee(s),
  2. learn more about the original intent of sudo & the sudoers file than I care to, or
  3. be prepared to pay -- possibly through the nose -- your hosting service for on-site maintenance in the event of disaster.

Edit: redgoblin posted while I was still writing (& Hangdog42 while I am editing), sorry for any duplication.

I like the idea of gradual additions to their privileges.

"Limiting their ability to do damage is much more productive than trying to clean up a mess afterward." is especially good advice.

I have a part in the group administration of several servers & am very interested in this. I would welcome posts of specific methods.

Last edited by archtoad6; 11-23-2010 at 07:56 AM.
 
Old 11-23-2010, 07:47 AM   #6
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
Quote:
Originally Posted by redgoblin View Post
Work out what it is you want them to be able to do and then set that up with the sudo command. As time goes on you can add more commands with root privileges as needs be.

Sudo also gives you the added bonus of logging all the privileged commands that get executed.

Personally if you can't 100% trust someone don't give them root access.

This is the way you handle the situation. The sudo command was designed to do exactly what you need. Looking for a backdoor to install probably wont' work since if they have the expertise to lock you out, they probably have the expertise to make sure that you can't use any back door. For example, what if they raised a firewall that only allowed SSH access from certain IP addresses? Or set up SSH to recognize only their account?

Limiting their ability to do damage is much more productive than trying to clean up a mess afterward.
 
Old 11-23-2010, 08:19 AM   #7
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,678

Rep: Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712
root access

It is not just a matter of trust: I am reluctant to give ANYONE the root account. I refuse to use it myself when anything else will serve. I log in as myself and use SUDO for logged and controlled access escalation.

I also use other tools so that I can extract a daily log of every command line that was executed at shell that day: but I am a paranoid old coot.

Last edited by wpeckham; 11-23-2010 at 08:21 AM.
 
Old 11-23-2010, 02:06 PM   #8
Joe of Loath
Member
 
Registered: Dec 2009
Location: Bristol, UK
Distribution: Ubuntu, Debian, Arch.
Posts: 152

Original Poster
Rep: Reputation: 28
Thanks, I'll check out using sudo! I'd thought about it, but didn't know it was so flexible. (I assumed it was mainly used to stop the bruteforcing of the root account over SSH and the like). All they'll need to be able to do is edit forum configuration files and install styles/modifications, so I guess I can just let them use root privileges in /var/www. Can I do that using sudo?
 
Old 11-23-2010, 02:51 PM   #9
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,680

Rep: Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971
Quote:
Originally Posted by Joe of Loath View Post
Thanks, I'll check out using sudo! I'd thought about it, but didn't know it was so flexible. (I assumed it was mainly used to stop the bruteforcing of the root account over SSH and the like). All they'll need to be able to do is edit forum configuration files and install styles/modifications, so I guess I can just let them use root privileges in /var/www. Can I do that using sudo?
Easily. You can even get VERY granular, and permit them to run only certain commands. For example, you can deny "vi /etc/shadow", but allow "vi /var/www/form.html".

Think VERY hard about the commands, though. It might seem like a good idea to permit "mkdir" or "cp" commands...but then there's nothing stopping them from running "sudo cp edited-shadow-file /etc/shadow", and removing the root password, for example. The fewer commands allow, the better. And if THEY have access to the box...what will stop them from booting from CD-ROM into single-user mode, and changing the password?
 
Old 11-24-2010, 05:23 AM   #10
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
Quote:
Originally Posted by Joe of Loath View Post
Thanks, I'll check out using sudo! I'd thought about it, but didn't know it was so flexible. (I assumed it was mainly used to stop the bruteforcing of the root account over SSH and the like).
Is this by any chance a result of experience w/ *buntu?

Quote:
Originally Posted by Joe of Loath View Post
All they'll need to be able to do is edit forum configuration files and install styles/modifications, so I guess I can just let them use root privileges in /var/www.
Why root? -- Look at the -u option.

Who, user & group, owns /var/www on your system? Show us the result of:
Code:
ls -dl /var/www
You want to find the simplest, lowest privilege way of accomplishing your goal. It may be as easy as letting these webserver maintainers sudo to become the system account which controls /var/www/.

From /etc/passwd on my MEPIS desktop box:
Code:
www-data:x:<N>:<M>:www-data:/var/www:/bin/sh
Now there is no /var/www/ on my system, so I can't show its ownership; but there is a "www-data" group as well as user, I suspect the ownership of /var/www/ would be root:www-data.


Quote:
Originally Posted by Joe of Loath View Post
Can I do that using sudo?
It appears so.
 
Old 11-24-2010, 03:21 PM   #11
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by TB0ne View Post
Easily. You can even get VERY granular, and permit them to run only certain commands. For example, you can deny "vi /etc/shadow", but allow "vi /var/www/form.html".
Not so easily. vi (from the sudo point of view) has two problems:
1. Ability to change edited file/write to any file, not just the one specified on the command line
2. shell escape (i.e from vi which is run as root) you can execute any command of course as root too.

Second problem can be dealt with by using noexec option (or something like this) in the sudoers file
First one (and second too) by using sudoedit.

While allowing to edit only one file doable it's not that obvious.

Last edited by Valery Reznic; 11-26-2010 at 12:34 PM.
 
Old 11-25-2010, 09:05 PM   #12
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,680

Rep: Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971
Quote:
Originally Posted by Valery Reznic View Post
Not so easily. v (from the sudo point of view) has two problems:
1. Ability to change edited file/write to any file, not just the one specified on the command line
2. shell escape (i.e from vi which is run as root) you can execute any command of course as root too.

Second problem can be dealt with by using noexec option (or something like this) in the sudoers file
First one (and second too) by using sudoedit.

While allowing to edit only one file doable it's not that obvious.
Right...it was only an example, and was also followed up with "Think VERY hard about the commands, though.".
 
Old 11-26-2010, 12:34 PM   #13
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by TB0ne View Post
Right...it was only an example, and was also followed up with "Think VERY hard about the commands, though.".
I just wanted to get more details to your "Think VERY hard about the commands, though." part.
No attack intended.

Valery.
 
Old 11-26-2010, 05:14 PM   #14
Joe of Loath
Member
 
Registered: Dec 2009
Location: Bristol, UK
Distribution: Ubuntu, Debian, Arch.
Posts: 152

Original Poster
Rep: Reputation: 28
Quote:
Originally Posted by TB0ne View Post
Easily. You can even get VERY granular, and permit them to run only certain commands. For example, you can deny "vi /etc/shadow", but allow "vi /var/www/form.html".

Think VERY hard about the commands, though. It might seem like a good idea to permit "mkdir" or "cp" commands...but then there's nothing stopping them from running "sudo cp edited-shadow-file /etc/shadow", and removing the root password, for example. The fewer commands allow, the better. And if THEY have access to the box...what will stop them from booting from CD-ROM into single-user mode, and changing the password?
No way anyone can access the server, it's virtualised and in Egypt XD

Quote:
Originally Posted by archtoad6 View Post
Is this by any chance a result of experience w/ *buntu?

Who, user & group, owns /var/www on your system? Show us the result of:
Code:
ls -dl /var/www
You want to find the simplest, lowest privilege way of accomplishing your goal. It may be as easy as letting these webserver maintainers sudo to become the system account which controls /var/www/.
Funnily enough, yes XD I use it on any box that is used by someone other than me.

I've tried many a time to change ownership of /var/www to a different user, but never managed it. I need to spend more time on it, really.
 
Old 11-27-2010, 11:08 AM   #15
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
Quote:
Originally Posted by Joe of Loath View Post
No way anyone can access the server, it's virtualised and in Egypt XD
...
Funnily enough, yes XD I use it on any box that is used by someone other than me.
What does "XD" mean in this context?

Quote:
Originally Posted by Joe of Loath View Post
I've tried many a time to change ownership of /var/www to a different user, but never managed it. I need to spend more time on it, really.
Never mind changing it for now, let's see if we can work around it -- please post the result of:
Code:
ls -dl /var/www
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
backdoor hacks yonnieboy Linux - Security 27 02-13-2010 04:27 AM
Yet another backdoor for IE.... r_jensen11 General 11 06-29-2004 11:31 AM
/home/backdoor glyn_walters Linux - Security 6 05-15-2003 11:29 AM
backdoor im1crazyassmofo Linux - General 3 01-16-2003 06:54 PM
SSH 2 as a backdoor? help me fenris@bu Linux - Security 3 05-24-2001 12:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration