有一个符号链接:
2:root@SERVER:/root # ls -la /usr/bin/passwd
lrwxrwxrwx 1 root system 39 Feb 3 2014 /usr/bin/passwd -> /usr/es/sbin/cluster/utilities/clpasswd
2:root@SERVER:/root #
还有原始的二进制文件:
2:root@SERVER:/root # ls -la /usr/es/sbin/cluster/utilities/clpasswd
-rwsr-xr-x 1 root system 413726 Aug 29 2013 /usr/es/sbin/cluster/utilities/clpasswd
2:root@SERVER:/root #
符号链接知道“-R”:
2:root@SERVER:/root # /usr/bin/passwd -R files root
Changing password for "root"
root's New password:
Terminating from signal
2:root@SERVER:/root #
clpasswd,原始二进制文件不知道“-R”
2:root@SERVER:/root # /usr/es/sbin/cluster/utilities/clpasswd -R files root
/usr/es/sbin/cluster/utilities/clpasswd: illegal option -- R
Usage: clpasswd cluster_user [ -g ResourceGroup ]
Where:
-g ResourceGroup - Update on participating nodes only
Otherwise all cluster nodes receive update
2:root@SERVER:/root #
当符号链接知道“-R”选项时,为什么原始二进制文件不知道它?
我们也尝试过硬链接,但没有成功。
答案1
二进制文件检查其文件名。
0:root@SERVER:/root # ln -s /usr/es/sbin/cluster/utilities/clpasswd /tmp/passwd
0:root@SERVER:/root # /tmp/passwd -R files root
Changing password for "root"
root's New password:
Terminating from signal
0:root@SERVER:/root # mv /tmp/passwd /tmp/clpasswd
0:root@SERVER:/root # /tmp/clpasswd -R files root
/tmp/clpasswd: illegal option -- R
Usage: clpasswd cluster_user [ -g ResourceGroup ]
Where:
-g ResourceGroup - Update on participating nodes only
Otherwise all cluster nodes receive update
0:root@SERVER:/root #