Hi all,
I really should know this, but I can’t for the life of me remember how
it goes. I want to change users within a Ruby script on Linux, but
Process::uid= only to takes an integer. What’s the best way to odo the
username => UID lookup?
Hi all,
I really should know this, but I can’t for the life of me remember how
it goes. I want to change users within a Ruby script on Linux, but
Process::uid= only to takes an integer. What’s the best way to odo the
username => UID lookup?
I really should know this, but I can’t for the life of me remember how
it goes. I want to change users within a Ruby script on Linux, but
Process::uid= only to takes an integer. What’s the best way to odo the
username => UID lookup?
I wouldn’t bet this is the best way, but it seams to work:
require ‘etc’
puts Etc::getpwnam(‘username’)[:uid]
Regards,
Rimantas
Alex Y. wrote:
Hi all,
I really should know this, but I can’t for the life of me remember how
it goes. I want to change users within a Ruby script on Linux, but
Process::uid= only to takes an integer. What’s the best way to odo the
username => UID lookup?
require ‘etc’
uid = Etc.getpwnam(‘username’).uid
Regards,
Dan
Daniel B. wrote:
uid = Etc.getpwnam(‘username’).uid
That’s the one! Thanks
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs