gpt4 book ai didi

macos - macos ssh-agent 中的 `-l` 标志是什么?

转载 作者:行者123 更新时间:2023-12-01 22:57:18 25 4
gpt4 key购买 nike

当我搜索手动启动 ssh-agent 的 PID 时,我还找到了进程 /usr/bin/ssh-agent -l。我试图在 man 中找到描述,但我做不到。什么是 -l 标志,它是否有用?

最佳答案

查看 source code ,它似乎是一个未记录的标志,与 ssh-agent 集成到 macOS 的 launchd 中有关,即用于与其他进程通信的 unix 文件套接字是如何创建(l_flag 如果在命令行上给出 -l 则设置):

#ifdef __APPLE_LAUNCHD__
if (l_flag) {
int *fds = NULL;
size_t count = 0;
result = launch_activate_socket("Listeners", &fds, &count);

if (result != 0 || fds == NULL || count < 1) {
errno = result;
perror("launch_activate_socket()");
exit(1);
}

size_t i;
for (i = 0; i < count; i++) {
new_socket(AUTH_SOCKET, fds[i]);
}

if (fds)
free(fds);

goto skip2;
} else {
#endif
prev_mask = umask(0177);
sock = unix_listener(socket_name, SSH_LISTEN_BACKLOG, 0);
if (sock < 0) {
/* XXX - unix_listener() calls error() not perror() */
*socket_name = '\0'; /* Don't unlink any existing file */
cleanup_exit(1);
}
#ifdef __APPLE_LAUNCHD__
}
#endif

我不熟悉launchd的概念,但是检查ssh-agent服务的配置显示了相应的部分:

$ launchctl print gui/1010/com.openssh.ssh-agent
[...]
sockets = {
"Listeners" = {
type = stream
path = /private/tmp/com.apple.launchd.4crvXaBll8/Listeners
secure key = SSH_AUTH_SOCK
owner uid = 1010
group id = 0

sockets = {
26 (bytes to read)
}

active = 1
passive = 1
bonjour = 0
ipv4v6 = 0
receive_packet_info = 0
}
}
[...]

关于macos - macos ssh-agent 中的 `-l` 标志是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72743995/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com