linux telnet server in.telnetd options telnet command line - server

linux telnet server in.telnetd options telnet command line
i try to use in.telnetd in centos linux command line to set some options
this is tool usage
Usage: telnetd [-debug|-debug6] [-D (options|report|exercise|netdata|ptydata)]
[-h] [-L login_program] [-n] [-N] [port]
on tool documents documentation -E can Disables encryption support negotiation
how i can use command to disable it or change it

Related

Remote SSH on VS Code in WSL2 password prompt

I am trying to connect to my server via SSH in VS Code for Ubuntu WSL2. However, whenever I make a connection, it is using the windows SSH instead of my Ubuntu WSL2. Is there anyway to start the remote SSH terminal in Ubuntu instead of the default Windows command prompt?
[10:14:37.201] Log Level: 2
[10:14:37.205] remote-ssh#0.62.0
[10:14:37.205] win32 x64
[10:14:37.208] "remote.SSH.sshPath": /usr/bin/ssh
[10:14:37.208] "remote.SSH.sshConfigurationFile": ~/.ssh/config
[10:14:37.245] Checking ssh with "/usr/bin/ssh -V"
[10:14:37.251] Got error from ssh: spawn /usr/bin/ssh ENOENT
[10:14:37.251] The specified path /usr/bin/ssh is not a valid SSH binary
[10:14:37.252] Checking ssh with "ssh -V"
[10:14:37.296] > OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
[10:14:37.300] Using SSH config file "~/.ssh/config"
[10:14:37.300] Running script with connection command: ssh -T -D 60054 -F "~/.ssh/config" "test-wsl" bash
[10:14:37.303] Terminal shell path: C:\WINDOWS\System32\cmd.exe
If anyone else ran into the same problem as me, it seems that remote server in VS Code is picking up cmd as the default terminal, so I had to copy my private keys over to /mnt/c/Users/{user}/.ssh directory in order to get ssh key based authentication to work. It would be better if I could change the default shell to C:\WINDOWS\System32\bash.exe.

How to log the output along with error messages to a file while running a script on psql command line on Freebsd OS?

On RHEL, the below command works:
psql -h hostname -U username -p port_no -d database -f /tmp/myfile.sql &> logfile01.txt
On FreeBSD, this throws error:
"Invalid null command"
Please suggest.
If you use this only on the command line then there is no need to change the shell.
To redirect stdout and stderr to a file in C-Shell synthax simply use ">& filename".
Different story is, if you want to write shell scripts. Bourne Shell and it's clones (like i.e. Bash) are better suited for writing script. See this Unix FAQ "Csh Programming Considered Harmful": http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/
This redirection works in bash
&> logfile01.txt
, but it does not work in csh which is the default shell in FreeBSD.
# set | grep shell
shell /bin/csh
# ls -la &> logfile01.txt
Invalid null command.
Bash is not installed by default. You can install it
pkg install bash
and configure it as the default shell.

How to get response from SCPG3 command

I'm using scpg3 command to copy file from local server to a remote server. My command is as below:
scpg3 <filename> user#remotehost:/tmp
My question is: how to get the result from this command. I want to move it to backup folder after copy successfully. Thanks
There is a verbose directly. You can use that:
scpg3 -v, --verbose
in your case,
scpg3 -v <filename> user#remotehost:/tmp
Uses verbose mode which is equal to -D 2. -D only applies on Unix. On Windows, instead of this command line tool, use the Connection Broker debugging options -D, -l.
D is the Debug level.
Hope it helps.

running command as local service (not user)

ss.exe command -I- won't run using local service
If I run the below command as a network user it works.
"C:\Program Files\SourceSafe\win32\SS.EXE" GET $/JavaSource -R -W -GL "d:\Release\com\fitltd" -GF- -O- -I- Set d:\Release\com\fitltd as the default folder for project $/JavaSource?(Y/N)N
However if this command is called using a local service user (Jenkins service) the command stops waiting for input (you can't see the question it is waiting (see above) for unless you run the same thing using a network user).
so the output looks like: "C:\Program Files\SourceSafe\win32\SS.EXE" GET $/JavaSource -R -W -GL "d:\Release\com\fitltd" -GF- -O- -I-
I am running Windows 2008 R2.

Determine if the stdout is terminal under ssh

To test whether the output is terminal we can do -t STDOUT:
if (-t STDOUT) {
# print with terminal control chars
} else {
# just plain print
}
But when the script is executed in the ssh session not run from terminal (Jenkins in my case), the -t test still returns true and my output gets polluted with control chars:
ssh user#server "/my/script.pl"
Why does the -t detects the terminal?
I don't know why ssh is allocating a terminal for you — mine defaults to not doing that even if the output of ssh goes to a terminal — but passing -T to ssh will disable pseudo-tty creation on the remote end.
$ ssh -t localhost "perl -E'say -t STDOUT ?1:0'"
1
Connection to localhost closed.
$ ssh -T localhost "perl -E'say -t STDOUT ?1:0'"
0
From ssh's man page:
-T Disable pseudo-tty allocation.
-t Force pseudo-tty allocation. This can be used to execute arbitrary
screen-based programs on a remote machine, which can be very useful,
e.g. when implementing menu services. Multiple -t options force tty
allocation, even if ssh has no local tty.
Perhaps it would be better if you instead forced ssh to allocate a pty —
From the ssh manual:
-t Force pseudo-tty allocation. This can be used to execute arbitrary screen-based programs
on a remote machine, which can be very useful, e.g. when implementing menu services.
Multiple -t options force tty allocation, even if ssh has no local tty.
The longer answer: -t (the Perl or Bourne shell function) reliably detects whether the stream is a “typewriter,” but ssh will normally only allocate a pseudo-teletype (pty) stream in interactive shells, not when other programs are being started.
See also RequestTTY as an option in .ssh/config.