Can't set ownership to system user

已查看 162 次
跳至第一个未读帖子

Алексей Гуносов

未读,
2016年9月15日 11:11:022016/9/15
收件人 Ansible Project
Hello.
I have a server with Ubuntu Server 16.04.1. I test some ansible features on it from my desktop with Ubuntu 16.04.1.
So I have system user "www-data" for Apache with uid=33(www-data) gid=33(www-data) groups=33(www-data).
I have directory /var/www/html/wordpress that I want to set permissions to the system user/group "www-data".
I write that in playbook:
file: path=/var/www/html/wordpress owner=www-data group=www-data mode=775 state=directory recurse=yes

So when I check the permissions of directory /var/www/html/wordpress I see that the owner is "1001" and group is "1001". But I haven't the user and group with uid and gid 1001. And this is the problem.
What can I do?

Алексей Гуносов

未读,
2016年9月16日 04:06:142016/9/16
收件人 Ansible Project
Please, help.

Kai Stian Olstad

未读,
2016年9月16日 12:41:042016/9/16
收件人 ansible...@googlegroups.com
On 15. sep. 2016 14:10, Алексей Гуносов wrote:
> Hello.
> I have a server with Ubuntu Server 16.04.1. I test some ansible features on
> it from my desktop with Ubuntu 16.04.1.
> So I have system user "www-data" for Apache with uid=33(www-data)
> gid=33(www-data) groups=33(www-data).
> I have directory /var/www/html/wordpress that I want to set permissions to
> the system user/group "www-data".
> I write that in playbook:
> file: path=/var/www/html/wordpress owner=www-data group=www-data mode=775
> state=directory recurse=yes

Mode should always start with a 0 since it's a octal.

To change the owner and group you need to be root to allow that.


> So when I check the permissions of directory /var/www/html/wordpress I see
> that the owner is "1001" and group is "1001". But I haven't the user and
> group with uid and gid 1001. And this is the problem.
> What can I do?

Since you have provided little information about how you run this it's
hard for people to help. Which user are you using, are you using become,
what is the output of ansible-playbook -vvvv <your playbook>

--
Kai Stian Olstad

Alexander H. Laughlin

未读,
2016年9月19日 13:18:002016/9/19
收件人 Ansible Project、ansible-pr...@olstad.com
Also, since a version prior to 2.0 it's been possible to specify the mode using non-octal notation. That is:
mode=ug+rw,o-rwx

Or, in a playbook:

- name: Update permissions on a file.
  file
:
    dest
: /path/to/file
    owner
: user
   
group: group
    mode
: ug+rw,o-rwx
    state
: file
 

Personally I prefer this method and recall being quite happy when it was implemented mostly because I just don't like octal notation. 

Алексей Гуносов

未读,
2016年10月3日 03:00:452016/10/3
收件人 Ansible Project
Friends, you are talking not about my issue :(
There are no answers for my question.

Please, help me with my question about how to set ownership to system user.


Brian Coca

未读,
2016年10月3日 10:34:322016/10/3
收件人 ansible...@googlegroups.com
Алексей,

Is the directory mounted from another system (nfs)? That can cause the disparity you see if the nfs exporter does not have same UID->user mappings as the nfs client system.


----------
Brian Coca

Алексей Гуносов

未读,
2016年10月3日 15:47:412016/10/3
收件人 Ansible Project
There are no any nfs shares.


четверг, 15 сентября 2016 г., 18:11:02 UTC+3 пользователь Алексей Гуносов написал:

Алексей Гуносов

未读,
2016年10月6日 12:39:222016/10/6
收件人 Ansible Project
So.
Can someone help me?

четверг, 15 сентября 2016 г., 18:11:02 UTC+3 пользователь Алексей Гуносов написал:
Hello.

Phonthip Namkaew

未读,
2016年10月6日 15:10:402016/10/6
收件人 Ansible Project
Try mode=0775

What is the output of < getent passwd > on that server ?

Алексей Гуносов

未读,
2016年10月7日 02:53:112016/10/7
收件人 Ansible Project
In my first message I said that I have already used mode=775.

Output of getent passwd:

root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
systemd-timesync:x:100:102:systemd Time Synchronization,,,:/run/systemd:/bin/false
systemd-network:x:101:103:systemd Network Management,,,:/run/systemd/netif:/bin/false
systemd-resolve:x:102:104:systemd Resolver,,,:/run/systemd/resolve:/bin/false
systemd-bus-proxy:x:103:105:systemd Bus Proxy,,,:/run/systemd:/bin/false
syslog:x:104:108::/home/syslog:/bin/false
_apt:x:105:65534::/nonexistent:/bin/false
messagebus:x:106:110::/var/run/dbus:/bin/false
uuidd:x:107:111::/run/uuidd:/bin/false
sshd:x:108:65534::/var/run/sshd:/usr/sbin/nologin
statd:x:109:65534::/var/lib/nfs:/bin/false
mysql:x:110:114:MySQL Server,,,:/nonexistent:/bin/false


четверг, 15 сентября 2016 г., 18:11:02 UTC+3 пользователь Алексей Гуносов написал:
Hello.
回复全部
回复作者
转发
0 个新帖子