If you run ssh testuser:20@<ip>
, then the "ssh" program--which I'll assume is the OpenSSH version--will transmit "testuser:20" to the remote SSH server as the login name for the connection.
An SSH server is free to interpret the login name however it wants to. The OpenSSH server logs the full login name received from the client, and then discards a colon and any text following it from the login name:
if ((r = sshpkt_get_cstring(ssh, &user, NULL)) != 0 ||
(r = sshpkt_get_cstring(ssh, &service, NULL)) != 0 ||
(r = sshpkt_get_cstring(ssh, &method, NULL)) != 0)
goto out;
debug("userauth-request for user %s service %s method %s", user, service, method);
debug("attempt %d failures %d", authctxt->attempt, authctxt->failures);
if ((style = strchr(user, ':')) != NULL) <-- Check for a colon
*style++ = 0; <-- Discard it
So the name including the colon and the following text isn't available during the remainder of the session.
It seems the only way to change this behavior with the OpenSSH server would be to change the source code of the ssh server program and use the altered version. OpenSSH is open source, so that's an option if the feature is important enough to you.
Alternately, you could look at alternative ssh servers--most or all of which will be commercial products--to see if one of them offers this feature.
testuser:20
then that's what you'll get, but if that's not the username they won't be able to connect. – Mr R Mar 15 '21 at 20:28testuser
. Just that when my script runs, $USER istestuser
and nottestuser:20
which I need. – lucifer Mar 16 '21 at 04:58ssh testuser:20@<IP>
for the non-CISCO IP? OR are you going to simulate the CISCO scenario with users testuser:1, testuser:2, etc. who all have same UID, home, but different shell? – Mr R Mar 16 '21 at 05:08ssh root:20@IP
ssh root:10@IP
with the IP of the VM and I was able to succesfully login to the VM. – lucifer Mar 16 '21 at 05:58root
. So, somehow either the ssh server is ignoring the :integer part or there is a way to utilize it... – lucifer Mar 16 '21 at 05:59