This is the development version of Kanrisuru. Since this is still a pre-1.0 release, we don't recommend using this in system-critical production environments.

Kanrisuru

whoami

Print the effective user id in ruby.
linux manual

Basic Usage

require 'kanrisuru'
host = Kanrisuru::Remote::Host.new(host: '127.0.1.1', username: 'ubuntu', keys: ['~/.ssh/id_rsa'])

result = host.whoami
result.success? 
true

result.user
"ubuntu"

Parameters

None

Result

Returns a UserName struct.

UserName Fields

Field Type Description
user string The user name of the current effective user

Return Example

host.whoami.data
#<Struct:Kanrisuru::Core::Path::UserName:0x000005c8
  user = "ubuntu"
>

Exit Status

Code Description
0 Success
1 Failure

Tested On

  • Ubuntu, Debian, Centos, Fedora, Redhat, OpenSuse, SLES