LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-05-2010, 01:12 AM   #1
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Rep: Reputation: 37
How do i remove commands.


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?
 
Old 10-05-2010, 01:19 AM   #2
basheer
Member
 
Registered: Mar 2009
Location: Bangalore, India
Distribution: CentOS6.5, CentOS7, Ubuntu14.04
Posts: 182

Rep: Reputation: 29
which distribution are you using?
it is not advisable to remove them using rm.
It's always better to use the package manager, or you will have commands to add or remove a software in your distribution.
 
Old 10-05-2010, 01:31 AM   #3
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,145
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
If its rpm based distro

List the rpm

Quote:
rpm -qa |grep -i rsh
Remove the rpm

Quote:
rpm -e --nodeps rsh

If its debian based distro
List package

Quote:
dpkg -l rsh
Remove package

Quote:
apt-get --purge remove rsh
--purge:removes package and configuration files
 
Old 10-05-2010, 01:39 AM   #4
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Original Poster
Rep: Reputation: 37
Quote:
Originally Posted by prayag_pjs View Post
If its rpm based distro

List the rpm



Remove the rpm




If its debian based distro
List package



Remove package



--purge:removes package and configuration files
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
 
Old 10-05-2010, 01:58 AM   #5
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,145
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
rcp and rlogin commands work in your system?

Did you use source code for installing rcp or rlogin?

Last edited by prayag_pjs; 10-05-2010 at 02:12 AM.
 
Old 10-05-2010, 01:59 AM   #6
Sayan Acharjee
Member
 
Registered: Feb 2010
Location: Chennai, India
Distribution: Manjaro
Posts: 616

Rep: Reputation: 64
Quote:
Originally Posted by pinga123 View Post
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?
I'd suggest you to change the permission for those commands or rename them instead of removing them. That way you can restore and get them working again whenever you want.
Use which command to know their location and then change their permission or rename them.

Quote:
#which rlogin
#which rsh
#which rcp
 
Old 10-05-2010, 01:59 AM   #7
solutionin
LQ Newbie
 
Registered: Sep 2010
Posts: 3

Rep: Reputation: 0
Change the file permisisons:

chmod 000 /usr/bin/rcp

chmod 000 /usr/bin/wget

chmod 000 /usr/bin/lynx

chmod 000 /usr/bin/links

chmod 000 /usr/bin/scp
 
Old 10-05-2010, 02:05 AM   #8
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,145
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
why to re-use un-secured service when we have ssh?better remove rsh!

Last edited by prayag_pjs; 10-05-2010 at 02:06 AM.
 
Old 10-05-2010, 02:08 AM   #9
sys64738
Member
 
Registered: May 2008
Location: NRW/Germany
Posts: 105

Rep: Reputation: 30
Hi
you nearly got it.
As far as I know rcp and rlogin is included in rsh-0.17-38.el5.
Do a "rpm -ql rsh-0.17-38.el5" to check. That should list the files belonging to
"rsh-0.17-38.el5".
You should be able to uninstall that RPM Package and get rid of what you want.

Last edited by sys64738; 10-05-2010 at 02:12 AM.
 
1 members found this post helpful.
Old 10-05-2010, 04:43 AM   #10
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Original Poster
Rep: Reputation: 37
Quote:
Originally Posted by sys64738 View Post
Hi
you nearly got it.
As far as I know rcp and rlogin is included in rsh-0.17-38.el5.
Do a "rpm -ql rsh-0.17-38.el5" to check. That should list the files belonging to
"rsh-0.17-38.el5".
You should be able to uninstall that RPM Package and get rid of what you want.
Thank you very much this is exact what i want.
# rpm -ql rsh-0.17-38.el5
/usr/bin/rcp
/usr/bin/rexec
/usr/bin/rlogin
/usr/bin/rsh
/usr/share/man/man1/rcp.1.gz
/usr/share/man/man1/rexec.1.gz
/usr/share/man/man1/rlogin.1.gz
/usr/share/man/man1/rsh.1.gz
 
Old 10-05-2010, 05:15 AM   #11
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Original Poster
Rep: Reputation: 37
From above methods i have noted down some methods of removing the command but i m yet confused which method should i follow.

As i m using it for my blog i have written it considering my blog in mind please help me evaluating the best one considering it wont affect other functionality.

It is highly recommended to remove following command on production server .
There are several ways of not using the command choose one that is suitable for your need.

Method 1:

Just try to find the rpm for the above command.
This can be done using.

Code:
rpm -qa | grep -i rsh
rsh-0.17-38.el5
rpm -qa | grep -i rcp
rpm -qa | grep -i rlogin
As you can see only first command return any output.

We need to further see what command rsh-0.17-38.el5 contains.

This can be done using

Code:
# rpm -ql rsh-0.17-38.el5
/usr/bin/rcp
/usr/bin/rexec
/usr/bin/rlogin
/usr/bin/rsh
/usr/share/man/man1/rcp.1.gz
/usr/share/man/man1/rexec.1.gz
/usr/share/man/man1/rlogin.1.gz
/usr/share/man/man1/rsh.1.gz

From the output you can assume that by uninstalling the rpm you can achieve the removal of those command from production server.


Method 2:

Change the file permisisons:

(First check the location of command using which command name.Below examples are given considering the commands are located under /usr/bin/rcp This could be different for different Linux Distributions.)
Code:
chmod 000 /usr/bin/rcp

chmod 000 /usr/bin/rsh

chmod 000 /usr/bin/rlogin
Method 3:

just remove execute bit of the command using.


(First check the location of command using which command name.Below examples are given considering the commands are located under /usr/bin/rcp This could be different for different Linux Distributions.)


Code:
chmod -x /usr/bin/rcp

chmod -x /usr/bin/rsh

chmod -x /usr/bin/rlogin
Method 4:

Remove the command itself using.
Code:
rm -rf  `which rcp`
rm -rf `which rlogin`
rm -rf  `which rsh`

Last edited by pinga123; 10-05-2010 at 06:04 AM.
 
Old 10-05-2010, 05:21 AM   #12
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677
If there is a command or file on your rpm based system, you can find the package which installed it with the comand:
rpm -qf /path/to/command

For example:
rpm -qf /usr/bin/ssh
openssh-5.4p1-8.2.x86_64

This doesn't remove the package. This locates the package that installed the file.
You can not uninstall the package using rpm (or yum or zypper) command or using your package manager.

For files you built from source, running "sudo make uninstall" from inside the program's source directory will uninstall the files.

Last edited by jschiwal; 10-05-2010 at 05:27 AM.
 
Old 10-05-2010, 06:05 AM   #13
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Original Poster
Rep: Reputation: 37
Quote:
Originally Posted by jschiwal View Post
If there is a command or file on your rpm based system, you can find the package which installed it with the comand:
rpm -qf /path/to/command

For example:
rpm -qf /usr/bin/ssh
openssh-5.4p1-8.2.x86_64

This doesn't remove the package. This locates the package that installed the file.
You can not uninstall the package using rpm (or yum or zypper) command or using your package manager.

For files you built from source, running "sudo make uninstall" from inside the program's source directory will uninstall the files.
Yes it was wrongly typed .Please suggest the best way of removing the commands.
 
Old 10-05-2010, 06:08 AM   #14
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,528

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
I would go with removing the executable bit


Kind regards
 
Old 10-06-2010, 12:43 AM   #15
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Original Poster
Rep: Reputation: 37
Quote:
Originally Posted by repo View Post
I would go with removing the executable bit


Kind regards
will this stop listening on port for rcp and rlogin?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
how to edit history to remove few commands executed g_ramesh Linux - Newbie 14 06-03-2015 03:42 AM
Linux equivalent commands for all Solaris commands Harry_Linux008 Linux - Newbie 4 08-22-2010 08:21 PM
Commands to remove particular few lines in the history file cartti Linux - Newbie 1 06-16-2010 01:57 PM
Need help for Windows cmd commands into Linux terminal commands. windowsNilo Linux - Software 2 07-02-2008 07:26 PM
Need help for Windows cmd commands into Linux terminal commands. windowsNilo Linux - General 2 07-01-2008 07:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:37 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration