samba,当然是samba了。(好像我还没听说过不基于samba的访问方式。。。)
1.查看共享资源列表:(我这里好像匿名的不成啊!?)
$ smbtree -U username
这里username是对方的“共享用户”。默认(不使用"-U")是使用本机当前登录用户名,但注意密码还是要输入对方机器上该用户名的密码。
2.访问对方共享资源:
$ smbclient -U username //host/dir
这里username同上,"//host/dir"是用smbtree查看到的对方共享资源(光只"//host/"是不成的)。
这个smbclient是个像ftp一样的东西,如果你以前用过控制台下的ftp这个应该很容易上手 :)
(BTW:有人说可以# mount -t smbfs ...的,但我的不行啊,也没有smbmount -_-,其实我个人觉得smbclient也不错,至少我对它不算陌生)
===========================================
# mount -t smbfs ...需要在编译内核的时候加入CONFIG_SMB_FS支持 ---- 07-01-24
# mount -t cifs ... CONFIG_CIFS
//EOF
Read More...
2009-03-28
访问Windowz的共享
Posted by
Davy Hawk
at
3/28/2009 07:49:00 PM
0
comments
Labels: shell
2007-04-20
console下特殊文件名的操作
有时候会碰到一些特殊的文件名如:"-aaa"
因为文件操作命令会自动把"-"后面跟的东西解析成option,所以一般来说都不能成功。
可以在文件名前面用参数“--”(两个减号),来达到操作这种文件的目的。如:
$ ls -l -- -aaa
(对于其他特殊字符可以用""把文件名括起来,或在特殊字符前加"\"解析符号)
另外,对于非ASCII字符命名的文件操作。(当前系统还未安装该语言支持时)
例:当前目录下有名为“abc你好”的目录
1.利用自动补全功能
$ cd abc<这里按Tab键> 自动补完后回车就可进入(前提是当前目录下无其他以"abc"开头的文件名)
2.需要工具 hexdump(util-linux包中)。
$ ls -ad abc* |hexdump -c
0000000 a b c 304 343 272 303 \n
$ cd `printf "abc\304\343\272\303"`
当然,如果当前目录存在多个以abc开头的文件就会麻烦很多,只有你自己通过后面的编码值来确定那个才是你真正需要的了。
//EOF
Read More...
Posted by
Davy Hawk
at
4/20/2007 10:00:00 AM
0
comments
2007-04-19
mount nfs: "can't read superblock"
# showmount -e 192.168.1.21
Export list for 192.168.1.21:
/home/share (everyone)
# mount -t nfs 192.168.1.21:/home/share /mnt/tmp
mount: 192.168.1.21:/home/share: can't read superblock
Solution: try using the -o nolock option from the nfs mount command
# mount -t nfs 192.168.1.21:/home/share /mnt/tmp -o nolock
//EOF Read More...
Posted by
Davy Hawk
at
4/19/2007 01:41:00 PM
0
comments
2007-03-01
小试Enlightenment
以前我一直用的XFCE,最近发现一个Enlightenment(http://www.enlightenment.org/)小巧美观(应该说靓丽),占用资源比XFCE少。配置感觉很像FVWM,这也难怪:
Enlightenment has a long and glorious past. When Raster was going attending University of New South Wales he began working with the newly released Xaw-Xpm. Leveraging Xaw-Xpm, he hacked up a new version of FVWM, which he called "FVWM-XPM". This new and improved FVWM allowed XPM images to be used in place of ugly Athena Widgets (FVWM started out in 1992 based on TWM).
说,Enlightenment 原本就是从 FVWM 发展过来的。
相关资源:
http://www.enlightenment.org/(官方站)
http://get-e.org/(这里有很多资源,文档、主题、图标 等)
http://enlightenment.freedesktop.org/
不过,感觉对他版本的命名有点不习惯。
E16是 Enlightenment Development Release 0.16.x.x省略了前面的"0."。(也叫DR16)
E17是还在开发中的版本。
Enlightenment就是发展的太慢了点 3年一个分版本啊~~
//EOF Read More...
Posted by
Davy Hawk
at
3/01/2007 08:06:00 PM
0
comments
2007-02-25
VirtualBox桥接局域网
一般情况下用VirtualBox虚拟个东西上网直接用"NAT"(guest安装VBoxGuestAdditions.iso后)就可以了,可以实现guest<->host及guest<->Intenet。
但要guest和局域网内的机器互访,还是虚拟个网卡后用bridge好些。
首先,需要内核的支持,在编译的时候加入"802.1d Ethernet Bridging" (in "Networking options") <CONFIG_BRIDGE>支持bridge 和 "Universal TUN/TAP device driver support" (in "Network device support")<CONFIG_TUN>支持tun设备(虚拟网卡)。
以下用到的命令tunctl在包uml-utilities中,brctl在包bridge-utils中。
(uml-utilities可以在 http://user-mode-linux.sourceforge.net/dl-sf.html 下载到,我只编译了uml_utilities_20040406.tar.bz2中的./tools/tunctl)
(注:其中'davy'是我的用户名,已加入'vboxusers'组)
# ifconfig eth0 down
# modprobe tun #如果没有/dev/net/tun的话用这个加载tun模块
# tunctl -t tap1 -u davy #创建虚拟网卡tap1
# brctl addbr br_vm #创建一个网桥br_vm
# brctl addif br_vm eth0 #向网桥br_vm添加物理网卡eth0
# brctl addif br_vm tap1 #向网桥br_vm添加虚拟网卡tap1
# ifconfig eth0 0.0.0.0 promisc up
#网桥的每个物理网卡作为一个端口,运行于混杂模式,而且是在链路层工作,所以就不需要IP了。
# ifconfig br_vm 192.168.1.21 netmask 255.255.255.0 broadcast 192.168.1.255 up
#然后给br_vm的虚拟网卡配置IP:192.168.1.21,那样就能远程管理网桥。
# route add default gw 192.168.1.2 dev br_vm #为br_vm添加网关
# ifconfig tap1 up
# chown root:vboxusers /dev/net/tun
# chmod 660 /dev/net/tun
VirtualBox中把Adapter0改成 Host interface,把Interface Name 那一栏添上tap1,然后启动虚拟系统,设置好IP,就可以访问局域网上的资源了。
用完后,删除桥接:
# ifconfig br_vm down
# brctl delif br_vm eth0 #移除和网桥间的关系
# brctl delif br_vm tap1
# brctl delbr br_vm #删除br_vm
# tunctl -d tap1 #删除虚拟网卡tap1
# ifconfig eth0 192.168.1.21 netmask 255.255.255.0 broadcast 192.168.1.255 up
# route add default gw 192.168.1.2 # 重新设置IP和网关
参考资料:
http://edeca.net/articles/bridging/index.html
http://linux-net.osdl.org/index.php/Bridge (http://bridge.sourceforge.net/)
//EOF Read More...
Posted by
Davy Hawk
at
2/25/2007 08:02:00 PM
2
comments
2007-01-21
some messages echo
昨天看LFS启动脚本时想到的。
Linux启动时会在每一行信息后都输出一个"[ OK ]"、"[ WARN ]"或"[ FAIL ]",这种输出方式在LFS启动脚本的function中可以得到解答:#!/bin/bash
# output just like linux-bootup message ".... [ OK ]"
## Screen Dimensions
# Find current screen size
if [ -z "${COLUMNS}" ]; then
COLUMNS=$(stty size)
COLUMNS=${COLUMNS##* }
fi
# When using remote connections, such as a serial port, stty size returns 0
if [ "${COLUMNS}" = "0" ]; then
COLUMNS=80
fi
## Measurements for positioning result messages
COL=$((${COLUMNS} - 8))
WCOL=$((${COL} - 2))
## Set Cursor Position Commands, used via echo -e
SET_COL="\\033[${COL}G" # at the $COL char
SET_WCOL="\\033[${WCOL}G" # at the $WCOL char
CURS_UP="\\033[1A\\033[0G" # Up one line, at the 0'th char
## Set color commands, used via echo -e
# Please consult `man console_codes for more information
# under the "ECMA-48 Set Graphics Rendition" section
#
# Warning: when switching from a 8bit to a 9bit font,
# the linux console will reinterpret the bold (1;) to
# the top 256 glyphs of the 9bit font. This does
# not affect framebuffer consoles
NORMAL="\\033[0;39m" # Standard console grey
SUCCESS="\\033[1;32m" # Success is green
WARNING="\\033[1;33m" # Warnings are yellow
FAILURE="\\033[1;31m" # Failures are red
INFO="\\033[1;36m" # Information is light cyan
BRACKET="\\033[1;34m" # Brackets are blue
STRING_LENGTH="0" # the length of the current message
echo -n -e "test test test .............. 11111"
echo -n " ||| now the fkjsal;kfa"
echo -e "${SET_COL}""${BRACKET}""[""${SUCCESS}"" OK ""${BRACKET}""]""${NORMAL}"
echo -n -e "test est esttt esttt ------------ 2222"
echo -e "${SET_COL}""${BRACKET}""[""${FAILURE}"" FAIL ""${BRACKET}""]""${NORMAL}"
echo -n -e "test ewa tasfj a;ksljet;a ljkeakl;j"
echo -e "${SET_COL}""${BRACKET}""[""${WARNING}"" WARN ""${BRACKET}""]""${NORMAL}"
另外,以前看到过的一个旋转的棍子表示进度的,用这种方式:#!/bin/bash
# a rout-line
if [ -z "${COLUMNS}" ]; then
COLUMNS=$(stty size)
COLUMNS=${COLUMNS##* }
fi
if [ "${COLUMNS}" = "0" ]; then
COLUMNS=80
fi
COL=$((${COLUMNS} - 20))
SET_COL="\\033[${COL}G" # at the $COL char
echo -n "asfdl;adfd;jja;:"
let n=0
while test $n -lt 5000 ; do
let n=`expr $n+1` # 这主要还起延时的作用,要不用`let n++`就行了
echo -en "${SET_COL}/"
let n=`expr $n+1`
echo -en "${SET_COL}|"
let n=`expr $n+1`
echo -en "${SET_COL}\\"
let n=`expr $n+1`
echo -en "${SET_COL}-"
done
echo -e "${SET_COL}[ OK ]"
//EOF
Read More...
Posted by
Davy Hawk
at
1/21/2007 12:51:00 PM
0
comments
2007-01-20
LFS单用户模式
今天发现LFS进单用户时会提示:
(or type Control-D to continue)
-_-还要输入密码!?和我平时印象中的单用户不同啊。
虽然在改grub的时候后面加个" init=/bin/bash"也可以进“单用户”。但还是不想这样麻烦。
单用户是[init 1]模式,启动脚本在/etc/rc.d/rc1.d/中,但光看这个目录里的东西是看不出什么的。
这里说一下,LFS的启动脚本和FC6的不同的地方。最大的不同是rcsysinit,LFS中和其他启动级别一样是一个目录的形式以'S'/'K'来判断启动与否(判断模式单一),FC6中是一个rc.sysinit的bash脚本(好处是:模式选则的多样性)
那么大多问题是出在这里,这里不想改动太多就在/etc/rc.d/init.d/中添加一脚本'single',链接之:
single文件内容:
#!/bin/bash
echo "########## Entering Single Mode ##########"
/bin/bash
但注意,/etc/inittab中,需要:
...
l1:S1:wait:/etc/rc.d/init.d/rc 1
...
//EOF Read More...
Posted by
Davy Hawk
at
1/20/2007 12:17:00 PM
0
comments
2007-01-16
tar用法进阶
以前一直没注意tar的用法(一般都是tar -xf ...),今天irc上面有个人问“怎么把一个包内的指定文件解出来?”我才仔细读了下man tar
(新版的tar可以自动识别包的格式所以那个'z'(*.tar.gz),'j'(*.tar.bz2)可以省略)
查看一个包内的文件列表('-t'):
$ tar -tf test.tar.bz2
(古老的用法:$ bunzip2 -cd test.tar.bz2 |tar -t)
解出包内的/test/test_a目录(文件)('-x'):
$ tar -f test.tar.bz2 -jx test/test_a
(古老的用法:$ bunzip2 -cd test.tar.bz2 |tar -x test/test_a)
//Continue...
Read More...
Posted by
Davy Hawk
at
1/16/2007 09:12:00 PM
0
comments
Labels: shell
