sous-chefs / users

Development repository for the users cookbook
https://supermarket.chef.io/cookbooks/users
Apache License 2.0
138 stars 218 forks source link

User not getting shell #397

Closed zaiddabaeen closed 7 years ago

zaiddabaeen commented 7 years ago

Cookbook version

4.0.3

Chef-solo version

12.18.31

Platform Details

Ubuntu 16.04

Scenario:

Shell command is not assigning a shell to the user.

Steps to Reproduce:

Recipe:

users_manage 'myusers' do
  group_id 1002
  action [:create]
  data_bag 'users'
end

In the databag:

{
  "id": "myuser",
  "uid": 1001,
  "ssh_keys": [
    "ssh-rsa <not shown>"
  ],
  "groups": [ "myusers" ],
  "password": "<not shown>",
  "shell": "\/bin\/bash"
}

Expected Result:

I can SSH to the user, and a bash shell to show.

Actual Result:

I can SSH to the user, but Instead I just get a "$" shell.

iennae commented 7 years ago

I'm not sure that there is a problem. Did you check /etc/passwd and verify that no shell was being set up?

I replicated your environment by doing:

chef generate cookbook test_user mkdir -p test/integration/data_bags/users vi test/integration/data_bags/users/data_bags/users/myuser (added the content as above)

Added the line

data_bags_path: 'test/integration/data_bags'

to .kitchen.yml

Updated the default recipe with your users_manage resource. I then did a kitchen converge and verified that the user was created with the bash shell.

vagrant@default-ubuntu-1604:~$ grep user /etc/passwd myuser:x:1001:1001::/home/myuser:/bin/bash

The prompt:

root@default-ubuntu-1604:~# sudo su - myuser myuser@default-ubuntu-1604:~$

Can you re-check your environment and confirm the user configuration in /etc/passwd?

iennae commented 7 years ago

Please reopen if this is still an issue and provide an update based on my previous comment? Thanks.