Dropbox命令行工具安装与开机自启动

系统要求
# 2.4 以上版本的C 库
# wget 命令
# Python 2.5
# web 浏览器

Dropbox命令行工具安装与使用的常用命令

cd ~ && wget -O – "http://www.dropbox.com/download?plat=lnx.x86" | tar xzf –
cd ~ && wget -O – "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf –
~/.dropbox-dist/dropboxd
killall dropbox

wget –no-check-certificate https://www.dropbox.com/download?dl=packages/dropbox.py
chmod 755 ~/dropbox.py
python dropbox.py start
python dropbox.py stop
python dropbox.py status

系统开机自启动脚本 /etc/init.d/dropbox

#!/bin/sh
#dropbox service
DROPBOX_USERS="user1 user2"

DAEMON=.dropbox-dist/dropbox

start() {
echo "Starting dropbox…"
for dbuser in $DROPBOX_USERS; do
HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
if [ -x $HOMEDIR/$DAEMON ]; then
HOME="$HOMEDIR" start-stop-daemon -b -o -c $dbuser -S -u $dbuser -x $HOMEDIR/$DAEMON
fi
done
}

stop() {
echo "Stopping dropbox…"
for dbuser in $DROPBOX_USERS; do
HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
if [ -x $HOMEDIR/$DAEMON ]; then
start-stop-daemon -o -c $dbuser -K -u $dbuser -x $HOMEDIR/$DAEMON
fi
done
}

status() {
for dbuser in $DROPBOX_USERS; do
dbpid=`pgrep -u $dbuser dropbox`
if [ -z $dbpid ] ; then
echo "dropboxd for USER $dbuser: not running."
else
echo "dropboxd for USER $dbuser: running (pid $dbpid)"
fi
done
}

case "$1" in

start)
start
;;
stop)
stop
;;
restart|reload|force-reload)
stop
start
;;
status)
status
;;
*)
echo "Usage: /etc/init.d/dropbox {start|stop|reload|force-reload|restart|status}"
exit 1

esac

exit 0

自启动命令:

chmod +x /etc/init.d/dropbox
update-rc.d dropbox defaults

Debian系统可能还需要在脚本前加上:

### BEGIN INIT INFO
# Provides: dropbox
# Required-Start: $local_fs $remote_fs $network $syslog $named
# Required-Stop: $local_fs $remote_fs $network $syslog $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# X-Interactive: false
# Short-Description: dropbox service
### END INIT INFO

本文来源及其它LINUX系统的使用方法参考: http://www.dropboxwiki.com/tips-and-tricks/install-dropbox-in-an-entirely-text-based-linux-environment#debianubuntu

Debian安装dropbear并添加nologin用户

编辑文件:

#vim /etc/shells

在最后添加:

/usr/sbin/nologin

修改原sshd端口为其它,如2200
文件路径:

#vim /etc/ssh/sshd_config

将Port 22改为port 2200
安装轻量化ssh服务:dropbear

#apt-get install dropbear

编缉dropbear配置文件,以便启用dropbear

#vim /etc/default/dropbear

将NO_START=1设置为NO_START=0
重启debian系统,sshd使用2200端口,dropbear使用22端口即可登录。
添加nologin用户,并设置密码,例如添加用户:guest,密码为:guest123:

#useradd guest -s /usr/sbin/nologin
#echo “guest:guest123” | chpasswd

完成用户添加后,还可以给用户设置过期时间。

#chage -E 2012-12-30 guest

原文:http://blog.humou.net/2012/02/22005.html