目录

这个文章摘自网络

其实我已经很久没有折腾迈拓网络硬盘,那个东西一直都放在柜子里,没有动过。因为我感觉这个东西,如果用来作为文件服务器,风险太大,因为他特有的文件格式,一旦出现问题,你就完蛋。

不过今天朋友问起,是否有可用的机器,用来做网站备份,通过ssh+rsync来实现,这倒是一个不错的注意,如果在迈拓网络硬盘上,可以实现这个功能,那么我的硬盘就算跑起来。

下面内容是从搜索引擎的cache找到的,所以copy一下。看来我改天研究一下这个,倒是很值得,也是解决了一个linux下,数据同步的问题。

O5 n4 k, Q1 c) A# S

安装迈拓网络硬盘盒全过程详解

迈拓网络硬盘盒安装 FTP

用PUTTY 连接硬盘盒

ipkg install vsftpd ---------

Installing vsftpd (2.0.3-2) to root...

Downloading http://ipkg.openmss.org/experimental/vsftpd_2.0.3-2_mipsel.ipk

Configuring vsftpd

安装完成,需要设置ftp访问的用户名和密码。

adduser test --------(test用户名可以改你自己的)

adduser: /home/test: No such file or directory

adduser: /home/test: No such file or directory

adduser: /home/test: No such file or directory

Changing password for test

Enter the new password (minimum of 5, maximum of 8 characters)

Please use a combination of upper and lower case letters and numbers.

Enter new password: --------密码

Bad password: too short. -------密码在6位下会去现,8位没有这项

Warning: weak password (continuing).

Re-enter new password: --------重复密码

Password changed.

实际我操作时 adduser命令是在 /opt/bin/下。

vi /opt/etc/vsftpd.user_list ---------

262版本的vi命令在目录 /opt/etc/vi

然后,依次操作vi will only show you the text file, you have to do the commands ?blind“. youruser

~

~

Delete the first line (dd) and enter (i) the name of the users you want…

现在按dd再按i,后输入用户名(就你刚刚建ftp的用户名)

test

~

~

Stop editing ([ESC]) save the file and quit vi (:wq)

按esc键2次,之后输入:wq 注意是冒号wq

Now, you’ll have to modify the users home directory, in case you have made your user with adduser. Therefore edit the file etc/passwd

vi /etc/passwd ---------

The original line might look like this:

test1$$XHRypMVmwwXaoHSogc3/F/:35002:35002inux User,,,:/home/test:/bin/sh --------test用户的资料

Change the line to (test will have his home directory in one of the public shares)

test1$$XHRypMVmwwXaoHSogc3/F/:35002:35002inux User,,,:/shares/mss-hdd/Yourshare:/bin/sh --------test用户的资料

Finally reboot your MSS to initialize the vsftpd service.

ok这就安装完了

busybox 介绍

BusyBox 是标准 Linux 工具的一个单个可执行实现。BusyBox 包含了一些简单的工具,例如 cat 和 echo,还包含了一些更大、更复杂的工具,例如 grep、find、mount 以及 telnet。有些人将 BusyBox 称为 Linux 工具里的瑞士军刀.

简单的说BusyBox就好像是个大工具箱,它集成压缩了 Linux 的许多工具和命令。

1、BusyBox 的诞生

BusyBox 最初是由 Bruce Perens 在 1996 年为 Debian GNU/Linux 安装盘编写的。其目标是在一张软盘上创建一个可引导的 GNU/Linux 系统,这可以用作安装盘和急救盘。

2、busybox的用法

可以这样用busybox

busybox ls

他的功能就相当运行ls命令

最常用的用法是建立指向busybox的链接,不同的链接名完成不同的功能.

ln -s busybox ls

ln -s busybox rm

ln -s busybox mkdir

  然后分别运行这三个链接:

./ls

./rm

./mkdir

  就可以分别完成了ls rm 和mkdir命令的功能.虽然他们都指向同一个可执行程序busybox,但是只要链接名不同,完成的功能就不同,很多linux网站都提供busybox的源代码下载。

  3、配置busybox

busybox的配置程序和linux内核菜单配置方式简直一模一样.熟悉用make menuconfig方式配置linux内核的朋友很容易上手.

cp busybox-1.00.tar.gz /babylinux

cd /babylinux

tar xvfz busybox-1.00.tar.gz

cd busybox-1.00

make menuconfig

  下面是需要编译进busybox的功能选项。

General Configuration应该选的选项

Show verbose applet usage messages

Runtime SUID/SGID configuration via /etc/busybox.conf

Build Options

Build BusyBox as a static binary (no shared libs)

  这个选项是一定要选择的,这样才能把busybox编译成静态链接的可执行文件,运行时才独立于其他函数库.否则必需要其他库文件才能运行,在单一个linux内核不能使它正常工作.

  Installation Options

  Don't use /usr

  这个选项也一定要选,否则make install 后busybox将安装在原系统的/usr下,这将覆盖掉系统原有的命令.选择这个选项后,make install后会在busybox目录下生成一个叫_install的目录,里面有busybox和指向它的链接.

  其它选项都是一些linux基本命令选项,自己需要哪些命令就编译进去,一般用默认的就可以了,配置好后退出并保存。

4、编译并安装busybox

make

make install

  编译好后在busybox目录下生成子目录_install,里面的内容:

drwxr-xr-x 2 root root 4096 11月 24 15:28 bin

rwxrwxrwx 1 root root 11 11月 24 15:28 linuxrc -> bin/busybox

drwxr-xr-x 2 root root 4096 11月 24 15:28 sbin

  其中可执行文件busybox在bin目录下,其他的都是指向他的符号链接.

MSS下的常用Linux命令

1.cat

当你刚装完openmss的时候,你telnet到mss上,你是无法使用vi的,那个时候你还没有装vi,你希望看某个文件的内容。怎么办。

cat 某个文件

2:set

这个是查看当前的环境变量,为什么不需要加/opt/bin 这个路径,就可以从这里看出,你可以比较登陆23,和2323端口的区别。

3:查看samba的版本

mss自带的是samba3.02,如何查看

/usr/local/samba/sbin/smbd -V

4:查看cpu,内存的使用

top

5:查看当前的进程

ps

6:停止某个进程

kill或者是 killall

后面可以是进程id,也可以是软件名称

7:vi的使用

我对vi的使用,也是基本阶段,

i 进入编辑状态

Esc 退出当前状态,你要退出编辑状态,就要按一下

:q 如果你没有做任何修改,直接q就可以退出

:q! 假如你的修改,不希望保存,那么这样就可以了

:wq 保存退出

/ 输入这个,你就可以查询某个字段的位置

我也就知道这些,不过基本可以对方mss,没有问题了

8:ipkg,用这种方式安装软件,可以降低安装软件的复杂性。很多时候ipkg安装软件比较慢,你可以把软件下载回来进行安装,如果这个软件需要其他的包,他会自动到网上寻找。

可以用这个来安装软件,详细的用法,可以看一下帮助

ipkg update 这是运行ipkg安装软件第一个需要运行的,每次telnet都需要

ipkg install busybox 安装软件

ipkg list 列出所有可以安装的软件

ipkg list | grep samba 把安装的软件包含samba列出来,

9:ln 链接目录

因为mss有个缺省的共享目录public,你可以把软件的下载路径改为这个目录,也可以把下载目录和public做一个链接,这样更加方便。

ln -s /opt/root/.mldonkey/incoming /shares/mss_hdd/public/downloads

这样你就会在downloads 的目录下看到一个incoming的目录

ipkg list_installed 列出所有已经安装的软件。

ipkg remove busybox 删除一个软件,不过只是删除这个软件,而不会把这个软件关联安装的包也卸载

10:mv

这个命令我经常用来改文件的命令,也可以移动文件

11:cp

这就是复制文件了,现在我还不会怎么把一个文件夹目录下的所有文件复制到另外一个文件夹下。

12:passwd

这个命令可以用来修改root的密码,root的用户没有密码,你通过ssh,ftp是无法登陆的。

13:mkdir

建立目录,不过在linux建立的目录,由于你是用root的身份建立的,所以你在windows访问就会有问题,权限的问题,解决的办法,就是修改权限。

14:chmod

修改权限,一个文件要能运行,chmod +x aaa

chmod 777 aaa

这样的目录,你就可以在windows下任意操作。

15:ls

这个命令就和windows下的dir一样,不过如果是隐藏文件,也就是文件,文件夹的前面带点的,那么就需要加参数才可以看到

ls /opt/root/ -la

就可以看到那些隐藏的文件夹了

16:cd

进入一个目录,不过通常你敲一个字母,可以通过tab键来补全。

cd /

这是退到根目录,这个命令很有用啊,因为你进入opt的目录是一个链接的文件夹,如果你 cd .. 退到上一层,但并不是根目录。

17:wget

这是用来下载软件的,后面跟参数 -P ,大写的p就可以指定你下载的目录。

18:tar

tar是一个打包,解包的命令,并不是压缩,解压的命令,这点要搞清楚。

tar cvf /shares/mss-hdd/Public/opt.tar /shares/mss-hdd/__opt/

这个命令的意思就是把/shares/mss-hdd/__opt/下进行打包,保存到/shares/mss-hdd/Public/下,压缩包的名字为opt.tar

19:unzip

在linux下,需要安装软件才可以解压rar文件,不过可以解压zip文件,

20:gunzip

假如别人是不是用zip压缩,文件是gz结尾的,那么你就需要用gunzip 来解压了

gunzip /shares/mss-hdd/Public/downloads/mss/mlnet.byte.gz

21:nasload

这个其实不算,是在windows下命令行使用,用来传fireware到mss上。

/f 上传的文件名

/u 用户名

/p 密码

/P 当你初始化的时候,密码为空,这就表示密码是空

/1 表示只上传1次。如果没有,他会不断尝试。

21:修改dns

nvram set lan_DNS=202.106.0.20 202.106.46.151

nvram commit

如果你通过这种方式

echo "nameserver 202.106.0.20" > /etc/resolv.conf

echo "nameserver 202.106.46.151" >> /etc/resolv.conf

是没有效果的。

22:echo

假如你希望在一个文件里添加一行,那么可以不使用vi,而用echo

echo src optware http://nslu2-linux.dyoung-mirror.net/feeds/optware/oleg/cross/stable/ >> /opt/etc/ipkg.conf

这样就在ipkg.conf 里增加一行

src optware http://nslu2-linux.dyoung-mirror.net/feeds/optware/oleg/cross/stable/

和你用vi去编辑的效果是一样的。

23:df -h

指令就可以了,可以显示每个分区的剩余空间。

我现在能想到整个安装过程能用到的linux命令就这些了。

安装好MSS后这个时候基本上要做几个工作

1、安装busybox

2、安装dropbear(SSH的服务端,个人选择吧,修改密码的时候能用的到)

ipkg update

Downloading http://ipkg.openmss.org/experimental/Packages

Updated list of available packages in /opt/lib/ipkg/lists/openmss

cat /opt/lib/ipkg/lists/openmss

Package: busybox

Version: 1.0-8

Replaces: busybox-cvs, busybox-static, busybox

Conflicts: busybox-cvs, busybox-static, busybox

Section: shells

Architecture: mipsel

Maintainer: Jon Suphammer mailto:jon@suphammer.net

MD5Sum: 5fd7b9914bb00bcd9aba07f479881f07

Size: 683066

Filename: busybox_1.0-8_mipsel.ipk

Source: http://ipkg.openmss.org/source/

Description: Standalone rescue shell with tons of builtin utilities.

Package: unrar

Version: 3.51-1

Section: archiving

Architecture: mipsel

Maintainer: Jon Suphammer mailto:jon@suphammer.net

MD5Sum: 4517175b97ce4c51c8aa085bc137e656

Size: 328226

Filename: unrar_3.51-1_mipsel.ipk

Source: http://ipkg.openmss.org/sources/

Description: Extract, test and view RAR archives

Package: vsftpd

Version: 2.0.3-2

Section: net

Architecture: mipsel

Maintainer: Jon Suphammer mailto:jon@suphammer.net

MD5Sum: a66f30b4560a0cc676a2bbd1e3aecb23

Size: 260538

Filename: vsftpd_2.0.3-2_mipsel.ipk

Source: http://ipkg.openmss.org/sources/

Description: a fast and secure FTP server

安装 busybox :

ipkg install busybox

ipkg install busybox

Installing busybox (1.0-8) to root...

Downloading http://ipkg.openmss.org/experimental/busybox_1.0-8_mipsel.ipk

Configuring busybox

如果觉得速度慢,可以下载到本地在上传到盒子上进行安装。效果一样~

安装dropbear

ipkg install dropbear

Installing dropbear (0.46-4) to root...

Downloading http://ipkg.openmss.org/experimental/dropbear_0.46-4_mipsel.ipk

Configuring dropbear

修改机器密码在telnet上是无法实现的,所以要用ssh来进行修改root用户密码的操作。

第一阶段的工作算是完成了。

修改环境变量,同时增加对debian-linux的支持

修改前环境变量如下

set

PS2=>

PS1=#

IFS=

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/opt/bin:/opt/sbin:/opt/usr/bin:/opt/usr/sbin

TERM=xterm

SHELL=/bin/sh

HOME=/

LOGNAME=root

USER=root

修改后# vi /opt/etc/init.d/S99local

!/bin/sh

utelnetd &

增加新的环境变量,补充到3333端口登陆的用户上

export PATH=/opt/bin:/opt/sbin:${PATH}

export LD_LIBRARY_PATH=/opt/lib:${LD_LIBRARY_PATH}

export HOME=/opt/root

export LC_ALL=zh_CN.UTF-8

utelnetd -p 3333 &

修改后,执行下,就可以用3333端口登陆安装软件了,环境变量如下:

C:Documents and SettingsAdministrator>telnet 192.168.1.253 3333

BusyBox v1.00-pre2 (2006.02.01-23:21+0000) Built-in shell (msh)

Enter 'help' for a list of built-in commands.

set

PS2=>

PS1=#

IFS=

PATH=/opt/bin:/opt/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/opt/bin:/opt/sbin:/opt/us

r/bin:/opt/usr/sbin

TERM=xterm

SHELL=/bin/sh

HOME=/opt/root

LOGNAME=root

USER=root

LD_LIBRARY_PATH=/opt/lib:

LC_ALL=zh_CN.UTF-8

以上就完成了安装常用软件所用环境变量的修改,如果没有修改的话安装软件会提示 /root目录不可读。

记得在opt目录下建立个root目录!!!

ls

bin etc lib sbin usr var

mkdir root

ls

bin etc lib root sbin usr var

cat /opt/etc/ipkg.conf

src openmss http://ipkg.openmss.org/experimental

最后编辑:2014年12月09日 ©著作权归作者所有

发表评论