查找在OS X登录钩子的Active Directory用户主文件夹

编程入门 行业动态 更新时间:2024-10-09 00:43:43
本文介绍了查找在OS X登录钩子的Active Directory用户主文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我需要写一个OS X登录钩子脚本,知道用户的当前主文件夹中。由于用户是Active Directory用户,他们的主文件夹不存储在/用户,所以我不能简单地硬code的完整路径。

I need to write a OS X login hook script that is aware of the users current home folder. Since the users are Active Directory users, their home folders are not stored in /Users so I can't simply hard code the full path.

由于登录连接是由后台程序以root身份运行,我不能用$ HOME,〜等无论是。

Since the login hook is run by a daemon as root, I can not use $HOME, ~, etc either.

唯一的一块信息我是被传入作为参数传递给该脚本的用户名。

The only piece of info I have is the users name which is passed in as an argument to the script.

有没有什么办法可以解决考虑到所有这些限制了用户的主文件夹?该脚本并不需要是一个登录钩必然,但它确实需要运行该登录到本机的所有AD用户。

Is there any way to resolve the users home folder given all these restraints? The script does not need to be a login hook necessarily, but it does need to run for all AD users that log into the machine.

推荐答案

事实证明,这个命令的伟大工程:

It turns out this command works great:

finger $USER_NAME | grep Directory | expand | cut -d ' ' -f 2

是必要的,因为如果扩展的文件夹路径很长,手指会用一个选项卡分离的空间领域,而不是。

The expand is needed because if the folder path is long, finger will use a tab to separate the fields instead of a space.

更多推荐

查找在OS X登录钩子的Active Directory用户主文件夹

本文发布于:2023-11-28 10:39:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1642063.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:主文   钩子   用户   OS   Directory

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!