You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
We are using below command to get the original login user. In some cases folks sudo as different user and run commands. In some cases folks use switch to different user (su - <>) and then run command. In all cases we would like to get original user who logged into the terminal to run the command. We are using below command to get the same.
user=os.getlogin()
We got three RHEL linux systems with Python 3 and strangely on two of them this command works fine. However only on third system it is failing with below error
OSError: [Errno 6] No such device or address
Not sure if it is some o/s env setup which is causing this command to fail. Any pointers to run this command will be of great help so that we can pin point the issue.
Please note on faiing system if I do python and then run the command it works fine without any issue. However if it is triggered through our Scheduler (Control M) it is failing with above message.
Give below is the command how Scheduler triggers the job.
os.getlogin() returns the name of the user logged in on the controlling terminal of the process. Typically processes in user session (tty, X session) have a controlling terminal. Processes spawned by a service manager like init, systemd, or upstart usually do not have a controlling terminal. You have to get the user information by other means. Our documentation for os.getlogin() recommends getpass.getuser().
Reacted by Timothy C. Quinn, dmacdougal, Tianhao Fu, Chih-Hsuan Yen, samueleliaskaps and Michael Altfield
Activity
ManickarajaKumarappan commentedon May 29, 2020
Hi,
We are using below command to get the original login user. In some cases folks sudo as different user and run commands. In some cases folks use switch to different user (su - <>) and then run command. In all cases we would like to get original user who logged into the terminal to run the command. We are using below command to get the same.
We got three RHEL linux systems with Python 3 and strangely on two of them this command works fine. However only on third system it is failing with below error
OSError: [Errno 6] No such device or address
Not sure if it is some o/s env setup which is causing this command to fail. Any pointers to run this command will be of great help so that we can pin point the issue.
Please note on faiing system if I do python and then run the command it works fine without any issue. However if it is triggered through our Scheduler (Control M) it is failing with above message.
Give below is the command how Scheduler triggers the job.
/bin/su - edwadm -c /bin/sh -x <>
Thanks
Manick.
tiran commentedon May 30, 2020
On POSIX os.getlogin() is a thin wrapper around the glibc function getlogin() https://linux.die.net/man/3/getlogin . The error is coming from glibc.
tiran commentedon Dec 16, 2020
errno 6 is ENXIO. According to https://www.man7.org/linux/man-pages/man3/getlogin.3.html the error code means "The calling process has no controlling terminal.".
os.getlogin() returns the name of the user logged in on the controlling terminal of the process. Typically processes in user session (tty, X session) have a controlling terminal. Processes spawned by a service manager like init, systemd, or upstart usually do not have a controlling terminal. You have to get the user information by other means. Our documentation for os.getlogin() recommends getpass.getuser().
Update git submodules
Use getpass.getuser() in test_privsep
[vllm,rollout] fix: vllm rollout lock file permission (#2805)
[vllm,rollout] fix: vllm rollout lock file permission (verl-project#2805
[vllm,rollout] fix: vllm rollout lock file permission (verl-project#2805
[vllm,rollout] fix: vllm rollout lock file permission (verl-project#2805
[vllm,rollout] fix: vllm rollout lock file permission (#2805)
[vllm,rollout] fix: vllm rollout lock file permission (verl-project#2805
[vllm,rollout] fix: vllm rollout lock file permission (verl-project#2805