How can I run my Jupyterlab server as runas /netonly
?
Or the equivalent in Powershell? On Windows?
How can I run my Jupyterlab server as runas /netonly
?
Or the equivalent in Powershell? On Windows?
So I created a different Windows account, and I installed Anaconda there.
When I log back into my regular account, I open a powershell window as another user run the Anaconda PS Prompt startup script and attempt to run Jupyterlab from there.
It starts the webserver for Jupyterlab, but when I visit it in my browser it just says that Jupyterlab is running; it doesn’t actually allow me to login; I’ve also tried pasting the token, but no dice.
So nobody knows anything about this? I have trouble believing that.
I imagine most people on Windows probably run JupyterLab as themselves.
More advanced JupyterLab setups tend to be on Linux, e.g. using JupyterHub to serve multiple users, or something else.
Well if they do, then they are doing it wrong. Because you shouldn’t use your default or admin windows account to login to an SQL server; how do you think data breaches happen?
Someone clicks on a link in an email that kicks off a script with your user account to SQL Server and dumps the data and sends it somewhere it shouldn’t go.
If you’re going to use Jupyter to access a database it should be using an domain account or a database local account to access it.
If you’re doing it any other way, you’re putting the data in the database at risk; especially if you’re running Windows.
I think non-administrators like data science people don’t realize that; their IT Departments should make them realize that. but maybe they don’t.
Your original post didn’t mention running JupyterLab on SQL server, nor did it mention why you were logged on as admin, so I just assumed you were trying to use runas
for curiosity!
If it’s a production SQLserver and you’re concerned about security I’d have thought you wouldn’t want to run JupyterLab on it, instead wouldn’t you run it on a separate system and connect to SQLserver over an authenticated connection?
It is not running on SQL Server; it’s connecting remotely to SQL Server; sorry if that wasn’t clear.
This is how to do this:
import pyodbc
import sqlalchemy as db
import pandas as pd
import os
windomain = os.environ[‘userdomain’]
if windomain == “YOURDOMAIN”:
server = ‘YOURSERVER’
database = ‘YOUDATABASE’
driver = “{SQL Server}”
# ** No need to type user or password.
connect = “DRIVER=”+driver+“;SERVER=”+server+“;DATABASE=”+database+“;Trusted_Connection=yes”
engine = db.create_engine(“mssql+pyodbc:///?odbc_connect={}”.format(connect))
else:
print(“Open as different user.”)
df = pd.read_sql(
“”"
SELECT TOP(100) *
FROM [YOURDATABASE]
“”",
con=engine,
)