0

I use TelnetClient (Apache Commons Net 3.7.2 API) login to solaris10 but I found that ~/.bash_profile could not load in user's work environment.

I think that Initial configuration file is ~/.profile in solaris10. But I need to use bash shell in solaris10.

So what can I do let my TelnetClient load ~/.bash_profile to my user's work environment by automatic after login.

Devin
  • 21
  • 2
  • Telnet shells are no different from other login shells. What is the user's default shell? The environment for ***that*** shell will be created in the normal manner for that shell. And note that `sh` is ***NOT*** `bash` - Linux distributions tend to conflate the two, but that is not strictly correct. – Andrew Henle Jan 15 '21 at 13:33
  • Hi Andrew Henle. The configuration file ~/.bash_profile is loaded when I use the same user login the solaris server by Tera Team. But It's not loaded when I use the same user login by my program TelnetClient. If as you said Telnet shells are no different from other login shells. It should be the same here, there is no difference. But actually ~/.bash_profile is not loaded when my program TelnetClient was login. – Devin Jan 16 '21 at 03:46

1 Answers1

0

I think I get the problem. I new a TelnetClient object in my source, like this:

private TelnetClient telnet = new TelnetClient();

I let TelnetClient constructor default sets terminal-type to "VT100". SO, I edit source like this:

private TelnetClient telnet = new TelnetClient("VT220");

I don't know why TelnetClient can't load ~/.bash_profile in Solaris10 under terminal-type of "VT100". Who can tell me the reason?

In any case, I need to formally test in a commercial environment and confirm that this change has no effect on TelnetClient logging into other types of servers. e.g. Linux

I will report the test result when I finished it.

Devin
  • 21
  • 2
  • You can try running `truss` against the daemon listening on port 23. Something like this should work: `truss -f -a -vall -o /path/to/output/file -p 912`. That will show you all the system calls made by the daemon and all the processes it starts up, including your login shell. I don't recall if Solaris 10 runs an actual `telnetd` or just uses `inetd` to listen on port 23. You can look into `/etc/inetd.conf` to find out. Solaris 11 uses `inetadm` and not `/etc/inetd.conf` - Solaris 10 might, too. Be careful with `truss` though - it's going to capture your login password in this case... – Andrew Henle Jan 18 '21 at 14:02