How do I remove commands?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How do I remove commands?
# 15  
Old 10-05-2010
Quote:
Originally Posted by Corona688
Are they really the same? Any difference could cause much confusion.
It varies by implementation. On solaris, scp is using -C for compression and on HPUX +C. But generally, the options for rcp match scp/scp2 and ssh/ssh2 matches rlogin and rsh. There is even sftp for ftp, but the options and commands are a bit less well matched.

Of course, the passwordless .rlogin is gone, and you need correct .ssh/ or .ssh2/ subtrees either in your home dir or the substitute dir (needed when home dirs are NFS) with keys and known hosts. For one id, once you get one host working, you can scp -p the subtree to the next host and everything but localhost/127.0.0.1 will work, give or take any funny hosts file entry contradictions.
# 16  
Old 10-06-2010
Quote:
Originally Posted by pinga123
and i just dont want someone to use those command in my system.
"Server hardening" means to make the servers operation more secure. As you have already beeen advised you should disable the server part of some unsecure protocols, which is done by disabling them in inetd.conf. Deleting some binaries (which are not the server-, but the client parts of the protocol) will

1) accomplish nothing because incoming connections would still be possible

2) alter the system because before this change you had a system where these binaries were present and afterwards you have a system where these binaries are not present. Altering the system is not advisable generally.

If you still think you have to change the system you should do so at least by using a package instead of doing it by hand.

Quote:
Originally Posted by pinga123
How are they going to change the system if i change their permissions.
??

I don't know who (or what) you mean by "they". If you mean "the binaries": "they" are not going to change the system, but YOU are going to change the system if you change their permissions.

Before this change you have: a set of files, directories, etc., all with some specific permissions. This is called "your system". If you alter the permission of a binary which is part of this system, you are altering it.

As I said above altering the system should be done only by applying/removing packages. The reason is that manual changes to the system are not documented well and usually not redoable. Imagine that your hardware breaks and you have to rebuild your server in exactly the same way it was: if you have done your change via a package you would obtain a list of all the packages installed on the old machine, apply all the packages (including yours) one after the other onto your new hardware and end up with the same server state as before.

If you have done that manually, you may or may not end up with the same system state as before, depending on if you can find the documentation of the change, if you remember that change having to be applied, etc., etc..

I hope this helps.

bakunin
This User Gave Thanks to bakunin For This Post:
# 17  
Old 10-06-2010
Quote:
Originally Posted by pinga123
I would like to remove rsh, rcp, rlogin from my production server.

How would i go about it?
Should i remove them from their original location using rm?
Will that impact on any other functionality?

---------- Post updated at 12:39 AM ---------- Previous update was at 12:16 AM ----------

Mine is rpm based distribution.

But i could not able to find rpm for rcp and rlogin.

Code:
# rpm -qa | grep -i rsh
rsh-0.17-38.el5
# rpm -qa | grep -i rcp
# rpm -qa | grep -i rlogin

Distribution Details.
Code:
# lsb_release -a
LSB Version:    :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: OracleVMserver
Description:    Oracle VM server release 2.2.0
Release:        2.2.0
Codename:       n/a

Code:
# uname -a
Linux OFSMUW-VS-61 2.6.18-128.2.1.4.9.el5xen #1 SMP Fri Oct 9 14:57:31 EDT 2009 i686 i686 i386 GNU/Linux

Hello
You have many options , if not needed uninstall them ...
Deactivate them via inetd.conf and the likes ...
If still needed by you, do a chmod 700 on them, so only root can run them .(the clients binaries , not the service )
But beware that if a user has a shell on the machine, he/she can upload its own client binaries and run them ...
# 18  
Old 10-06-2010
The consensus from posts #14 and #16 is to disable the service daemons such as "rlogind" by controlling "inetd" rather than messing with the binaries for outgoing programs such as "rlogin". It is inadvisible to change the permissions on the deamons because you could crash inetd .

Always have a known good backup and a regression plan before making changes.
# 19  
Old 10-06-2010
So, there are no available daemons for direct listening to spawn rsh, rlogin and rcp (rsync, remsh, rexec, . . . ?)? Still, just removing/commenting inetd and maybe services lines seems fragile.

All the system distributions should deliver these commands as an optional package that you do not install, unless you accept the vulnerabilities and have some need to support them, way yesterday dude! Smilie

These vulnerabilities should be down to near the same level as ftp and telnet if properly configured: plain text data on the network, but with the added concern of passwordless login between hosts. If there are not configurable controls to block * user or host, then as root, you can scan for dumb .rhosts files on every host. They are not so bad on well firewalled subnets of an intranet.
# 20  
Old 10-06-2010
Quote:
Originally Posted by DGPickett
So, there are no available daemons for direct listening to spawn rsh, rlogin and rcp (rsync, remsh, rexec, . . . ?)? Still, just removing/commenting inetd and maybe services lines seems fragile.
If by 'fragile' you mean 'does not lobotomize it to the point it'll never work again' then yes, it's fragile, and we are weak-minded cowards for suggesting it. Smilie

By broader standards, well: All it amounts to is an init system, if you're willing to rely on your init scripts to boot the machine you can rely on this to not boot RCP. Comment out the RCP settings and it won't understand how to use RCP any more. It's also the correct way; disabling RCP just by blasting holes in the executables doesn't warn inetd of this, so could cause weird error messages. An attacker would have to modify arbitrary files as root, or induce inetd to run and/or modify arbitrary files as root, in order to kick RCP on; if he could do that you're screwed with or without RCP.

(I don't like inetd either, but because of how complicated it makes everything, not any particular security complications. It just runs daemons, the daemons run as per usual.)

Last edited by Corona688; 10-06-2010 at 06:31 PM..
# 21  
Old 10-07-2010
Quote:
Originally Posted by Corona688
An attacker would have to modify arbitrary files as root, or induce inetd to run and/or modify arbitrary files as root, in order to kick RCP on; if he could do that you're screwed with or without RCP.

(I don't like inetd either, but because of how complicated it makes everything, not any particular security complications. It just runs daemons, the daemons run as per usual.)
Part of security is making it hard to open a vulnerability, and enabling easy detection of newly established holes. Once your sysytem is compromised, how hard it is to discover the trap door? An insider might put a listener on a cron somewhere so he can connect and get some sort of access without these executables, or with them renamed and running on odd ports. A PERL script could do this. You might need a port scanner to ensure you like all the listeners. Wherever you lock out the unwanted, now you need ways to ensure the lock has not been removed.

Many simple minded or strict security audits look for these commands installed, so removal becomes a political necessity.

(For one audit, I used a binary replace to make a new shared lib with a different trap door password, as we did not have the source or a clean, compatible version! However, the install default master password was still in use!)

Last edited by DGPickett; 10-07-2010 at 01:37 PM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Bash to remove find and remove specific extension

The bash below executes and does find all the .bam files in each R_2019 folder. However set -x shows that the .bam extension only gets removed from one .bam file in each folder (appears to be the last in each). Why is it not removing the extension from each (this is $SAMPLE)? Thank you :). set... (4 Replies)
Discussion started by: cmccabe
4 Replies

2. Post Here to Contact Site Administrators and Moderators

Please remove this post/remove information from it

In this thread: /shell-programming-and-scripting/255687-organizing-text-file-capital-names-capital-word-capital-word.html (sorry i cant use links) that is not an example, those are real students names with real student login id's for the college i am attending and i am on that list. Please... (3 Replies)
Discussion started by: throwawayacc
3 Replies

3. Shell Programming and Scripting

remove brackets and put it in a column and remove repeated entry

Hi all, I want to remove the remove bracket sign ( ) and put in the separate column I also want to remove the repeated entry like in first row in below input (PA156) is repeated ESR1 (PA156) leflunomide (PA450192) (PA156) leflunomide (PA450192) CHST3 (PA26503) docetaxel... (2 Replies)
Discussion started by: manigrover
2 Replies

4. AIX

HACMP: difference between 'cl' commands and 'cli' commands

Hi all, I'm new in this forum. I'm looking for the difference between the HACMP commands with the prefix "cl" and "cli". The first type are under /usr/es/sbin/cluster/sbin directory and the second are under /usr/es/sbin/cluster/cspoc directory. I know that the first are called HACMP for AIX... (0 Replies)
Discussion started by: peppix
0 Replies

5. Shell Programming and Scripting

command to remove multiple commands in particular columns

Hi Experts, I actually need to remove multiple commas within the column not the entire row. Its comma delimited file Actually the value seems to look like 1,006,000, when we open this in notepad or word pad the value look s like “1,006,000” Actually our Sed command removes single comma and... (7 Replies)
Discussion started by: bshivali
7 Replies

6. Shell Programming and Scripting

To remove date and duplicate rows from a log file using unix commands

Hi, I have a log file having size of 48mb. For such a large log file. I want to get the message in a particular format which includes only unique error and exception messages. The following things to be done : 1) To remove all the date and time from the log file 2) To remove all the... (1 Reply)
Discussion started by: Pank10
1 Replies

7. Shell Programming and Scripting

Can BASH execute commands on a remote server when the commands are embedded in shell

I want to log into a remote server transfer over a new config and then backup the existing config, replace with the new config. I am not sure if I can do this with BASH scripting. I have set up password less login by adding my public key to authorized_keys file, it works. I am a little... (1 Reply)
Discussion started by: bash_in_my_head
1 Replies

8. Programming

code that reads commands from the standard i/p and executes the commands

Hello all, i've written a small piece of code that will read commands from standard input and executes the commands. Its working fine and is execting the commands well. Accepting arguments too. e.g #mkdir <name of the directory> The problem is that its not letting me change the directory i.e... (4 Replies)
Discussion started by: Phrozen Smoke
4 Replies

9. UNIX for Advanced & Expert Users

Remove Commands from Buffer

Hi.. When I execute a command, say for ex.. cp ../../* to ..../.../* and then when I use escape K, enter... it shows the commands recently executed. How can we remove that commands from buffer? This is a sun-solaris 8 environment.. Thanks, ST2000 (3 Replies)
Discussion started by: ST2000
3 Replies

10. UNIX for Dummies Questions & Answers

smitty, remove user, remove directory as well..

hi, i am on aix. i used smitty to remove a user.. but then found that its directory still exists.... so i have to remove the directory manually... am i doing it the right way? (2 Replies)
Discussion started by: yls177
2 Replies
Login or Register to Ask a Question