|
发表于 2008-7-13 14:22:04
|
显示全部楼层
- [liuhongdan@dan ~]$ su
- Password:
- [root@dan liuhongdan]# fdisk -l
- bash: fdisk: command not found
- [root@dan liuhongdan]# exit
复制代码 注意区别:- [liuhongdan@dan ~]$ su -
- Password:
- [root@dan ~]# fdisk -l
- Disk /dev/sda: 75.7 GB, 75722577408 bytes
- 255 heads, 63 sectors/track, 9206 cylinders
- Units = cylinders of 16065 * 512 = 8225280 bytes
- Disk identifier: 0xbf5fbf5f
- Device Boot Start End Blocks Id System
- /dev/sda1 * 1 1912 15358108+ c W95 FAT32 (LBA)
- /dev/sda2 1913 9205 58581022+ f W95 Ext'd (LBA)
- /dev/sda5 1913 3824 15358108+ b W95 FAT32
- /dev/sda6 3825 6374 20482843+ b W95 FAT32
- /dev/sda7 6375 6387 104391 83 Linux
- /dev/sda8 6388 6641 2040223+ 82 Linux swap / Solaris
- /dev/sda9 6642 8568 15478596 83 Linux
- /dev/sda10 8569 9205 5116671 83 Linux
复制代码- man su
- SU(1) User Commands SU(1)
- NAME
- su - run a shell with substitute user and group IDs
- SYNOPSIS
- su [OPTION]... [-] [USER [ARG]...]
- DESCRIPTION
- Change the effective user id and group id to that of USER.
- -, -l, --login
- make the shell a login shell
复制代码
/sbin/*是给超级用户用的,必须是login shell的。非login shell的时候,环境变量并不会变的。从你自己的代码就能看出来:- [cz@linsvr ~]$ su
- 口令:
- [root@linsvr cz]# fdisk -l
- bash: fdisk: command not found
- [root@linsvr cz]#
复制代码 su之后,连目录都没跳转。 |
|