Network user on Linux

I am able to get the network user in windows though ENV[‘username’] but
this is not wokring on linux,
Is there any library we can use in both environments to get the network
user login?

On Mon, Sep 12, 2011 at 12:52 PM, Mario R. [email protected] wrote:

I am able to get the network user in windows though ENV[‘username’] but
this is not wokring on linux,
Is there any library we can use in both environments to get the network
user login?

user = ENV[‘USER’] || ENV[‘USERNAME’]

or maybe

require ‘etc’
user = Etc.getlogin

Kind regards

robert

thanks a lot!!! it is working!!

Another thing related to this is, I need to get access to a file that is
on network drive and the problem is I can access it on windows like
//fileserver…
but in linyx is by using smb://fileserver so I need to identify which
system I’m using or if there is any way to do the same in both
systems…

Robert K. wrote in post #1021423:

On Mon, Sep 12, 2011 at 12:52 PM, Mario R. [email protected] wrote:

I am able to get the network user in windows though ENV[‘username’] but
this is not wokring on linux,

On Mon, Sep 12, 2011 at 1:24 PM, Mario R. [email protected] wrote:

thanks a lot!!! it is working!!

Another thing related to this is, I need to get access to a file that is
on network drive and the problem is I can access it on windows like
//fileserver…
but in linyx is by using smb://fileserver so I need to identify which
system I’m using or if there is any way to do the same in both
systems…

You could configure the URL and do this before file open on Windows:

path_to_open = windows? : file_name.sub /^smb:/, ‘’ : file_name

Kind regards

robert