Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accidentally deleted smbd and proftpd services

Status
Not open for further replies.

negation

IS-IT--Management
Apr 1, 2004
2
0
0
US
Subject header says it all. I'm a complete Linux newbie and wanted to prevent Samba and the ProFTP services from running on startup.

Not knowing what I was doing, I removed "smbd" and "proftpd" from the /etc/init.d/ directory (I think that's the directory). How can I get these back?

By the way, I'm running Mandrake 10.

Any help is greatly appreciated,

--
 
You probably know by now that you should have issued an:

/etc/init.d/smbd stop

Right?

I'm not a rpm user but I imagine there's a way to reinstall from and rpm without overwriting your configuration files. Grab the samba-server and proftpd rpms and reinstall the apps.

Ian

 
You didn't delete the executables, you deleted the init scripts that call them. Here is a copy of /etc/rc.d/init.d/proftpd:

Code:
#!/bin/sh
#
# Startup script for ProFTPD
#
# chkconfig: 345 85 15
# description: ProFTPD is an enhanced FTP server with #              a focus toward simplicity, security, and ease of configuration. #              It features a very Apache-like configuration syntax, #              and a highly customizable server infrastructure, #              including support for multiple 'virtual' FTP servers, #              anonymous FTP, and permission-based directory visibility.
# processname: proftpd
# config: /etc/proftpd.conf
#
# By: Osman Elliyasa <osman@Cable.EU.org>
# $Id: proftpd.init.d,v 1.7 2002/12/07 21:50:27 jwm Exp $

# Source function library.
. /etc/rc.d/init.d/functions

if [ -f /etc/sysconfig/proftpd ]; then
      . /etc/sysconfig/proftpd
fi

PATH="$PATH:/usr/local/sbin"

# See how we were called.
case "$1" in
	start)
		echo -n "Starting proftpd: "
		daemon proftpd $OPTIONS
		echo
		touch /var/lock/subsys/proftpd
		;;
	stop)
		echo -n "Shutting down proftpd: "
		killproc proftpd
		echo
		rm -f /var/lock/subsys/proftpd
		;;
	status)
		status proftpd
		;;
	restart)
		$0 stop
		$0 start
		;;
	reread)
		echo -n "Re-reading proftpd config: "
		killproc proftpd -HUP
		echo
		;;
	suspend)
		hash ftpshut >/dev/null 2>&1
		if [ $? = 0 ]; then
			if [ $# -gt 1 ]; then
				shift
				echo -n "Suspending with '$*' "
				ftpshut $*
			else
				echo -n "Suspending NOW "
				ftpshut now "Maintanance in progress"
			fi
		else
			echo -n "No way to suspend "
		fi
		echo
		;;
	resume)
		if [ -f /etc/shutmsg ]; then
			echo -n "Allowing sessions again "
			rm -f /etc/shutmsg
		else
			echo -n "Was not suspended "
		fi
		echo
		;;
	*)
		echo -n "Usage: $0 {start|stop|restart|status|reread|resume"
		hash ftpshut
		if [ $? = 1 ]; then
			echo '}'
		else
			echo '|suspend}'
			echo 'suspend accepts additional arguments which are passed to ftpshut(8)'
		fi
		exit 1
esac

if [ $# -gt 1 ]; then
	shift
	$0 $*
fi

exit 0

Here is /etc/rc.d/init.d/smb:

Code:
#!/bin/sh
#
# chkconfig: - 91 35
# description: Starts and stops the Samba smbd and nmbd daemons #	       used to provide SMB network services.
#
# pidfile: /var/run/samba/smbd.pid
# pidfile: /var/run/samba/nmbd.pid
# config:  /etc/samba/smb.conf


# Source function library.
if [ -f /etc/init.d/functions ] ; then
  . /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
  . /etc/rc.d/init.d/functions
else
  exit 0
fi

# Avoid using root's TMPDIR
unset TMPDIR

# Source networking configuration.
. /etc/sysconfig/network

if [ -f /etc/sysconfig/samba ]; then
   . /etc/sysconfig/samba
fi

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

# Check that smb.conf exists.
[ -f /etc/samba/smb.conf ] || exit 0

# Check that we can write to it... so non-root users stop here
[ -w /etc/samba/smb.conf ] || exit 0


RETVAL=0


start() {
        KIND="SMB"
	echo -n $"Starting $KIND services: "
	daemon smbd $SMBDOPTIONS
	RETVAL=$?
	echo
        KIND="NMB"
	echo -n $"Starting $KIND services: "
	daemon nmbd $NMBDOPTIONS
	RETVAL2=$?
	echo
	[ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && touch /var/lock/subsys/smb || 	   RETVAL=1
	return $RETVAL
}	

stop() {
        KIND="SMB"
	echo -n $"Shutting down $KIND services: "
	killproc smbd
	RETVAL=$?
	echo
	KIND="NMB"
	echo -n $"Shutting down $KIND services: "
	killproc nmbd
	RETVAL2=$?
	[ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && rm -f /var/lock/subsys/smb
	echo ""
	return $RETVAL
}	

restart() {
	stop
	start
}	

reload() {
        echo -n $"Reloading smb.conf file: "
	killproc smbd -HUP
	RETVAL=$?
	echo
	return $RETVAL
}	

rhstatus() {
	status smbd
	status nmbd
}	

case "$1" in
  start)
  	start
	;;
  stop)
  	stop
	;;
  restart)
  	restart
	;;
  reload)
  	reload
	;;
  status)
  	rhstatus
	;;
  condrestart)
  	[ -f /var/lock/subsys/smb ] && restart || :
	;;
  *)
	echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}"
	exit 1
esac

exit $?

copy and paste both of these to your /etc/rc.d/init.d directory.
 
Careful negation, RhythmAce is assuming you have your binaries installed in the same place s/he does.

I think you're better off reinstalling your rpms while first, perhaps, backing up your conf files.

Ian

ps. if you do follow RhythmAce's advice, make sure your chmod +x the files you create or they aren't going to run.


 
I managed to get Samba working by performing an rpm -qa | grep samba command, deleting the rpms listed, and installing the Samba-common and Samba-server rpms.

One odd thing that I noticed is that the service is no longer called smbd, but smb3. It's no big deal, though. I'm just glad that it works.

Now, for proftpd, I couldn't find any already installed rpm packages. How do I go about removing it?

Another question: I downloaded the proftpd and wu-ftp tar.gz files and attempted to install them. Upon running ./configure, it complained about GCC not being installed. Where can I find that?

Thanks,

--
 
You'll need to install the compiler, probably from rpm.

This would be a good time to start using a package manager manager like apt-get or yum. I prefer yum. These will go out to repositories on the net, find the latest packages available, resolve any dependencies, download the required packages and install them for you. Saves a lot of headaches.

is an excellent starting place.

In the future if you want to disable a startup service, use chkconfig. Basically 'chkconfig ftpd off' would turn off your ftp service. It works by manipulating symbolic links in other directories in the /etc heirarchy.

Learning how the computer boots is an excellent exercise to learn Unix as a whole.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top