Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Username with @ divided into "user" and "domain" in Linux OS #8675

Open
System25 opened this issue Jun 20, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@System25
Copy link

commented Jun 20, 2019

Description

In Linux systems when the username contains the at symbol "@" and you use the "script" resource, the username is internally divided into "user" and "domain" (like in a Windows system based in Active Directory) and thus the user is not found --> ERROR.

In Debian based systems a username may contain as many @ symbols as you may want.
If you try to create an user with a wrong character (for example a question mark "?") the adduser command will tell you the allowed format for the username:

adduser: To avoid problems, the username should consist only of letters, digits, underscores, periods, at signs and dashes, and not start with a dash (as defined by IEEE Std 1003.1-2001). For compatibility with Samba machine accounts $ is also supported at the end of the username.

I think that this is a bug and the username must not be divided into "user" and "domain" in a Linux OS.

Chef Version

Chef v12.22.5-1 (amd64)

Platform Version

Ubuntu 16.04 xenial

Replication Case

      username = "CaCaMan@2_3-$"
      bash "copy skel to #{username}" do
        user username.to_s
        code "export LC_ALL=$LANG\n"\
          "/usr/bin/xdg-user-dirs-update --force\n"
        action :nothing
      end.run_action(:run)

Client Output



================================================================================

[31mError executing action `run` on resource 'bash[copy skel to CaCaMan@2_3-$]'

================================================================================



ArgumentError

-------------

can't find user for CaCaMan



Cookbook Trace:

---------------

/var/cache/chef/cookbooks/gecos_ws_mgmt/providers/local_users.rb:60:in `block (2 levels) in class_from_file'

/var/cache/chef/cookbooks/gecos_ws_mgmt/providers/local_users.rb:27:in `each'

/var/cache/chef/cookbooks/gecos_ws_mgmt/providers/local_users.rb:27:in `block in class_from_file'



Resource Declaration:

---------------------

# In /var/cache/chef/cookbooks/gecos_ws_mgmt/providers/local_users.rb



 55:           bash "copy skel to #{username}" do

 56:             user username.to_s

 57:             code "export LC_ALL=$LANG\n"\

 58:               "/usr/bin/xdg-user-dirs-update --force\n"

 59:             action :nothing

 60:           end.run_action(:run)

 61:         end

 62:       end



Compiled Resource:

------------------

# Declared in /var/cache/chef/cookbooks/gecos_ws_mgmt/providers/local_users.rb:55:in `block (2 levels) in class_from_file'



bash("copy skel to CaCaMan@2_3-$") do

  action [:nothing]

  retries 0

  retry_delay 2

  default_guard_interpreter :default

  command "copy skel to CaCaMan@2_3-$"

  backup 5

  returns 0

  user "CaCaMan"

  code "export LC_ALL=$LANG\n/usr/bin/xdg-user-dirs-update --force\n"

  interpreter "bash"

  declared_type :bash

  cookbook_name "gecos_ws_mgmt"

  domain "2_3-$"

end



System Info:

------------

chef_version=12.22.5

platform=ubuntu

platform_version=16.04

ruby=ruby 2.3.6p384 (2017-12-14 revision 61254) [x86_64-linux]

program_name=chef-client worker: ppid=6148;start=12:38:05;

executable=/opt/chef/bin/chef-client



[2019-06-20T12:38:14+02:00] ERROR: bash[copy skel to CaCaMan@2_3-$] (/var/cache/chef/cookbooks/gecos_ws_mgmt/providers/local_users.rb line 55) had an error: ArgumentError: can't find user for CaCaMan

[2019-06-20T12:38:14+02:00] ERROR: /opt/chef/embedded/lib/ruby/2.3.0/fileutils.rb:1116:in `getpwnam'

/opt/chef/embedded/lib/ruby/2.3.0/fileutils.rb:1116:in `fu_get_uid'

/opt/chef/embedded/lib/ruby/2.3.0/fileutils.rb:1057:in `chown'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/provider/script.rb:77:in `set_owner_and_group'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/provider/script.rb:62:in `action_run'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/provider.rb:145:in `run_action'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/resource.rb:622:in `run_action'

/var/cache/chef/cookbooks/gecos_ws_mgmt/providers/local_users.rb:60:in `block (2 levels) in class_from_file'

/var/cache/chef/cookbooks/gecos_ws_mgmt/providers/local_users.rb:27:in `each'

/var/cache/chef/cookbooks/gecos_ws_mgmt/providers/local_users.rb:27:in `block in class_from_file'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/provider/lwrp_base.rb:86:in `instance_eval'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/provider/lwrp_base.rb:86:in `block in action'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/provider.rb:145:in `run_action'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/resource.rb:622:in `run_action'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/runner.rb:69:in `run_action'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/runner.rb:97:in `block (2 levels) in converge'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/runner.rb:97:in `each'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/runner.rb:97:in `block in converge'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/resource_collection/resource_list.rb:94:in `block in execute_each_resource'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/resource_collection/stepable_iterator.rb:114:in `call_iterator_block'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/resource_collection/stepable_iterator.rb:103:in `iterate'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/resource_collection/resource_list.rb:92:in `execute_each_resource'

/opt/chef/embedded/lib/ruby/2.3.0/forwardable.rb:204:in `execute_each_resource'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/runner.rb:96:in `converge'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/client.rb:718:in `block in converge'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/client.rb:713:in `catch'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/client.rb:713:in `converge'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/client.rb:752:in `converge_and_save'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/client.rb:286:in `run'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/application.rb:295:in `block in fork_chef_client'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/application.rb:283:in `fork'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/application.rb:283:in `fork_chef_client'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/application.rb:248:in `block in run_chef_client'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/local_mode.rb:44:in `with_server_connectivity'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/application.rb:236:in `run_chef_client'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/application/client.rb:464:in `sleep_then_run_chef_client'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/application/client.rb:451:in `block in interval_run_chef_client'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/application/client.rb:450:in `loop'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/application/client.rb:450:in `interval_run_chef_client'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/application/client.rb:434:in `run_application'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/lib/chef/application.rb:59:in `run'

/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.22.5/bin/chef-client:26:in `<top (required)>'

/usr/bin/chef-client:57:in `load'

/usr/bin/chef-client:57:in `<main>'

[2019-06-20T12:38:14+02:00] INFO: Processing gecos_ws_mgmt_jobids[local_users_res] action reset (/var/cache/chef/cookbooks/gecos_ws_mgmt/providers/local_users.rb line 87)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.