Log in to NJU’s campus network portal without a browser. njulogin login uses a saved password, njulogin qr draws the CAS QR code in the terminal for the NJU app to scan, and status, logout and kick cover the rest of what the portal page does.
njulogin 0.2.1 is an MIT-licensed CLI for macOS and Linux, on Intel and ARM.
Why njulogin
The portal at p.nju.edu.cn expects a browser. That is fine on a laptop and awkward on a lab server, a NAS or a headless box behind a campus port that has to log in before it can reach anything. njulogin speaks the portal’s protocol directly, so a login is one command, a script can check the result from the exit status, and the same command works for a machine you only reach through SSH.
Project snapshot
Not affiliated with Nanjing University. The saved password is a plaintext file protected by Unix permissions (directory 0700, file 0600), not a keychain entry.
0
Tools needed on the remote host besides sshd
2
Ways to log in: saved password or CAS QR code
4
Release builds: macOS and Linux, each on x86_64 and ARM
0.2.1
Current release · MIT
Log in a machine you can only SSH into
1/2
njulogin remote my-host login logs in the network path behind my-host. Nothing runs on that host: the local binary opens ssh -W tunnels through it to the portal and CAS, and handles HTTP, TLS, cookies and QR polling itself. Your SSH aliases, keys and ProxyJump apply as usual, and remote my-host qr shows that host’s QR code on your own screen.
Passwords stay out of arguments and logs
2/2
njulogin setup prompts for the password without echo. A login takes exactly one credential source: the saved file, --ask, --password-stdin, or --password-command for a trusted secret helper. Output is redacted, failures exit nonzero, and njulogin update keeps it current, checking each download against the digest GitHub publishes.