How to identify a user?

42 views (last 30 days)
Iain
Iain on 30 Jul 2013
I have a body of code that is being used & abused by some of my users. I would like to be able to find out who has been using the code, by adding a user ID to the outputs.
I can't use the name of who the matlab licence is licenced to as it is always "Authorised User".
  3 Comments
dpb
dpb on 30 Jul 2013
'USER' returns empty here
'USERNAME' under Windows has a chance't, maybe, ...
There's a Win API GetUserName that is the logged-in account that the environment variable should mimic; I've never investigated how easy it is nor whether it makes any difference to anything if the user does something like clear the environment variable, etc., etc., ...
"Know nothink'" to quote Sgt Schultz on the TMW license id of multi-use licenses, etc., as to whether you could get something from that...sounds like a question to Tech Support.
Cedric
Cedric on 30 Jul 2013
Edited: Cedric on 30 Jul 2013
The cynical part of me thinks that you could urlread() a controversial topic and check out who's not at work on Monday, or get the usage statistics through PRISM.
More seriously, I am using some lib. to access NCBI databases and, as NCBI wants (without enforcing it) an email address inside queries, the lib. semi-enforces users to define their address by displaying a warning() message when no email was defined. As those warnings are quite annoying, I guess that people generally take time to define their address.
con = NCBIconnector() ;
con.email = 'myEmailAddress' ; % Skip this "one time operation" and
% you get a warning for each query.
data = con.fetch(...) ;
Otherwise, why not storing MAC or IP addresses? If you and these users are working for the same company and using "wired" machines, it shouldn't be too difficult to have this mechanism allowed by the IT(?)

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 31 Jul 2013
In Windows 7 you can find out who logged in by examining the user's personal folder. Do this:
userProfile = getenv('USERPROFILE');
and then extract out the login name of the account that logged in.
  2 Comments
Walter Roberson
Walter Roberson on 31 Jul 2013
I seem to recall that USERPROFILE is something that can be configured (possibly only by administrator) on Windows 7, so in some uncommon cases this might not work as expected. For example, on clusters of shared computers, the administrator might choose to set the profile location to a shared drive.
Iain
Iain on 31 Jul 2013
This does the job.

Sign in to comment.

More Answers (1)

Jan
Jan on 30 Jul 2013
It depends on how the user can be identified: Does he or she work on the same computer and/or the same login every time? Is it a user in a domain setup working from different computers? Which operating systems are concerned? Is Matlab called through a SSH tunnel on a server, such that e.g. the MAC address will not be individual for the user?
As usual it is worth to search in the FileExchange:
But be aware that such a control can conflict with the laws of privacy protection. The fact, that your software is abused does not allow to break the laws.
Therefore a simple method could be to inform all users about the problem and let them type their real name on top of the files. Of course cheating is easy, but it requires at least an intended act of lying then.

Categories

Find more on Entering Commands in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!