简体   繁体   中英

How to get windows login username in EC2 ubuntu flask app or command prompt

I need to get the windows login username in my Flask app which is deployed in AWS EC2 instance.

Hmm, I'm assuming your Flask application is running on a Windows EC2 instance and you want to get the login username on the local instance that it is running on? In that case, it really should be as simple as retrieving it from the environment variables, for example using this python snippet:

import os

USER = os.getenv('USERNAME')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM