An error caused by symbolic links pointing to each other

本文详细介绍了在Linux系统中遇到符号链接形成循环错误的原因、解决步骤及使用scp命令复制文件的过程,并提供了ssh命令的使用指南,包括选项、用途和常见用法。

An error will be caused by symbolic links pointing to each other

Because thiscause a symlink loop.

Just like this:

bash-3.00$ /usr/bin/ssh
bash: /usr/bin/ssh: Number of symbolic links encountered during path name traversal exceeds MAXSYMLINKS
# /usr/local/bin/ssh
/usr/local/bin/ssh: cannot execute
# ls -lrth /usr/local/bin/ssh
lrwxrwxrwx 1 root root 18 May 31 07:05 /usr/local/bin/ssh -> /usr/local/bin/ssh
# /usr/local/bin/ssh
/usr/local/bin/ssh: cannot execute
# ls -lrth /usr/local/bin/ssh
lrwxrwxrwx 1 root root 18 May 31 07:05 /usr/local/bin/ssh -> /usr/local/bin/ssh
# ls -lrth /usr/bin/ssh
lrwxrwxrwx 1 root root 18 May 31 07:05 /usr/bin/ssh -> /usr/local/bin/ssh

Both are the symbolic links.

Logon the other nodes and copy the ssh file to it.

$ scp /usr/bin/ssh grid@perf-5240-2:/usr/bin/ssh
scp: /usr/bin/ssh: Number of symbolic links encountered during path name traversal exceeds MAXSYMLINKS

Remove the ssh symlink file from the first node.

copy again.
$ scp /usr/bin/ssh droot@perf-5240-2:/usr/bin/ssh
Password:
ssh 100% |********************************************| 259 KB 00:00
$
Then go back the first node and try the ssh command again:

# ssh
You have to specify host.
Usage: ssh [options] host [command]
Options:
-l user Log in using this user name.
-n Redirect input from /dev/null.
-F config Config file (default: ~/.ssh/config).
-A Enable authentication agent forwarding.
-a Disable authentication agent forwarding (default).
-X Enable X11 connection forwarding.
-x Disable X11 connection forwarding (default).
-i file Identity for public key authentication (default: ~/.ssh/identity)
-t Tty; allocate a tty even if command is given.
-T Do not allocate a tty.
-v Verbose; display verbose debugging messages.
Multiple -v increases verbosity.
-V Display version number only.
-q Quiet; don't display any warning messages.
-f Fork into background after authentication.
-e char Set escape character; ``none'' = disable (default: ~).
-c cipher Select encryption algorithm
-m macs Specify MAC algorithms for protocol version 2.
-p port Connect to this port. Server must be on the same port.
-L listen-port:host:port Forward local port to remote address
-R listen-port:host:port Forward remote port to local address
These cause ssh to listen for connections on a port, and
forward them to the other side by connecting to host:port.
-D port Enable dynamic application-level port forwarding.
-C Enable compression.
-N Do not execute a shell or command.
-g Allow remote hosts to connect to forwarded ports.
-1 Force protocol version 1.
-2 Force protocol version 2.
-4 Use IPv4 only.
-6 Use IPv6 only.
-o 'option' Process the option as if it was read from a configuration file.
-s Invoke command (mandatory) as SSH2 subsystem.
-b addr Local IP address.
# exit
bash-3.00$ ssh
You have to specify host.
Usage: ssh [options] host [command]
Options:
-l user Log in using this user name.
-n Redirect input from /dev/null.
-F config Config file (default: ~/.ssh/config).
-A Enable authentication agent forwarding.
-a Disable authentication agent forwarding (default).
-X Enable X11 connection forwarding.
-x Disable X11 connection forwarding (default).
-i file Identity for public key authentication (default: ~/.ssh/identity)
-t Tty; allocate a tty even if command is given.
-T Do not allocate a tty.
-v Verbose; display verbose debugging messages.
Multiple -v increases verbosity.
-V Display version number only.
-q Quiet; don't display any warning messages.
-f Fork into background after authentication.
-e char Set escape character; ``none'' = disable (default: ~).
-c cipher Select encryption algorithm
-m macs Specify MAC algorithms for protocol version 2.
-p port Connect to this port. Server must be on the same port.
-L listen-port:host:port Forward local port to remote address
-R listen-port:host:port Forward remote port to local address
These cause ssh to listen for connections on a port, and
forward them to the other side by connecting to host:port.
-D port Enable dynamic application-level port forwarding.
-C Enable compression.
-N Do not execute a shell or command.
-g Allow remote hosts to connect to forwarded ports.
-1 Force protocol version 1.
-2 Force protocol version 2.
-4 Use IPv4 only.
-6 Use IPv6 only.
-o 'option' Process the option as if it was read from a configuration file.
-s Invoke command (mandatory) as SSH2 subsystem.
-b addr Local IP address.

### 寻找并解决410 Gone错误 #### 错误原因分析 当遇到`410 Gone` HTTP状态码时,表示请求的资源已被永久移除且不再可用。此情况通常发生在服务器上原本存在的资源被有意删除之后[^2]。 #### 解决方案探讨 针对该类问题,解决方案取决于具体的应用场景: - **确认资源存在性**:检查所访问URL对应的文件或数据库记录是否确实已经被删除。如果是预期行为,则应更新前端链接指向新的位置或者告知用户资源已不可用。 - **版本控制与历史存档**:对于某些网站而言,在删除内容之前可以考虑将其归档或将旧版保存下来供特定条件下访问。这样即使原路径返回了410响应,也可以引导至替代页面查看过期资料。 - **API设计优化**:如果是在开发RESTful API过程中遇到了这个问题,建议遵循最佳实践来管理资源生命周期。比如采用软删除机制标记而非物理销毁数据;或是引入时间戳参数允许获取指定日期前后的快照视图。 ```python from flask import Flask, jsonify, abort app = Flask(__name__) @app.route('/resource/<int:id>') def get_resource(id): resource = find_resource_by_id(id) if not resource.exists(): app.logger.info(f'Resource {id} has been permanently removed.') response = { "error": f"The requested resource with ID '{id}' is no longer available." } return jsonify(response), 410 return jsonify(resource.to_dict()) if __name__ == '__main__': app.run() ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值