[root@VENUS /data]# cd ..
[root@VENUS /]# cd /home/AD/
[root@VENUS AD]# ls
ad_user1 ad_user2  test_1
[root@VENUS AD]# ls -lh ad_user/
total 280K
-rw-r--r--  1 AD\ad_user1 AD\domain users  46K Feb 13 15:14 7_chips_2row.cir
....................................

↑正常情況下看到的owner是長這樣!但我需要使用者的id,這個在/etc/user中沒有列出來,因為不是local user。

 

[root@VENUS AD]# ls -ln ad_user1/
total 280
-rw-r--r--  1 16777220 16777218 46949 Feb 13 15:14 7_chips_2row.cir
-rw-r--r--  1 16777220 16777218  2584 Feb 13 15:14 7_chips_2row.sp
..............................

就可以看到這個AD User的UID為16777220,GID為16777218。

[root@VENUS AD]# cd /data/

[root@VENUS /data]# chown 16777220 localuser

[root@VENUS /data]# ls -al

drwx------  36              16777216 localgroup       4096 Apr 27 15:40 localuser1
drwx------. 32 AD\ad_user1           localgroup       4096 Apr 27 15:12 localuser2

就可以看到更改完成的樣子了!新的AD User就拿到原本舊的本機使用者的全部權限。

不過有時候是名字,有時候是號碼,並不影響使用。

 

參考資料:https://community.spiceworks.com/topic/219517-how-do-i-chown-a-file-or-directory-to-an-ad-user

Hunter G
Poblano
Best Answer
Hunter G

This isn't working for you because there is no "username" stored for AD users in your /etc/passwd file. Look at the files owned by the domain users(eg their home directory), use the "ls -ln" command to view the UID who owns that file(numeric number, not name). Once you have that number, you can set ownership of the files using it.

 

EG:

(see how the file is owned by 'root')
[root@shackhost ~]# ls -lh
-rw-r--r-- 1 root root    0 May  2 11:27 foo

(the '0' is the UID of root)
[root@shackhost ~]# ls -ln foo
-rw-r--r-- 1 0 0 0 May  2 11:27 foo

For the purpose of this example, my system has an AD user called "jdoe" with a UID of 1666678. Even though I can't type "chown jdoe foo", I can type "chown 1666678 foo", and now my AD user "jdoe" will own that file.

Hope this helps.

文章標籤
創作者介紹

片刻、瞬間、不知所云...

貓熊麗麗 發表在 痞客邦 PIXNET 留言(0) 人氣()


留言列表 (0)

發表留言
找更多相關文章與討論