Telnet

Hi,

I am trying to get telnet working on my BSP image using QNX SDK 6.5. I include
my build file below, there are only slight changes from the original.
I have disabled the firewall on my Windows PC. And I’m using tsec1.

When I try to telnet from Windows to the target it trys to connect and says
“Could not open connection to the host, on port 23: Connect failed”.

Telnet from QNX to windows gives:

telnet 192.168.0.70

Trying 192.168.0.70…
telnet: Unable to connect to remote host: Connection refused

Can anyone give any advice as to what I need to do to get this working
correctly?

Thanks

ifconfig

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33192
inet 127.0.0.1 netmask 0xff000000
tsec0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
capabilities rx=7<IP4CSUM,TCP4CSUM,UDP4CSUM>
capabilities tx=0
enabled=0
address: 00:00:12:34:56:78
media: Ethernet autoselect (1000baseT full-duplex)
status: active
inet 1.2.3.4 netmask 0xff000000 broadcast 1.255.255.255
tsec1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
capabilities rx=7<IP4CSUM,TCP4CSUM,UDP4CSUM>
capabilities tx=0
enabled=0
address: 00:00:12:34:56:7a
media: Ethernet autoselect (1000baseT full-duplex)
status: active
inet 192.168.0.80 netmask 0xffffff00 broadcast 192.168.0.255

###########################################################################

QNX Neutrino 6.4.0 on the Freescale MPC8313E RDB board

###########################################################################

SUPPORTED DEVICES:

SERIAL: DUART

NETWORK: eTSEC1( five Vitesse VSC7385) and eTSEC2 (Marvell 88E1111 PHY)

I2C:

FLASH: (SPANSION S29GL054A90TFIR3)

NAND:

SPI:

PCI:

USB:

- For detailed instructions on the default example configuration for

these devices see the “CONFIGURING ON-BOARD SUPPORTED HARDWARE”

section below the build script section, or refer to the BSP docs.

- Tip: Each sub-section which relates to a particular device is marked

with its tag (ex. SERIAL). You can use the search features of

your editor to quickly find and add or remove support for

these devices.

- For details on how build files work, please refer to the help

documentation for “mkifs” in the QNX Neutrino Utilities Reference.

###########################################################################

NOTES:

###########################################################################

###########################################################################

START OF BUILD SCRIPT

###########################################################################

[image=0x200000]
[+compress]
[virtual=ppcbe,raw] .bootstrap = {
startup-mpc8313e-rdb -vvvv
#######################################################################
## PATH set here is the safe path for executables.
## LD_LIBRARY_PATH set here is the safe path for libraries.
## i.e. These are the paths searched by setuid/setgid binaries.
## (confstr(_CS_PATH…) and confstr(_CS_LIBPATH…))
#######################################################################
PATH=:/proc/boot:/bin:/usr/bin LD_LIBRARY_PATH=:/proc/boot:/lib:/usr/lib:/lib/dll procnto-600 -vvvv
}
[+script] startup.script = {
procmgr_symlink …/…/proc/boot/libc.so.3 /usr/lib/ldqnx.so.2

display_msg Welcome to QNX Neutrino 6.4.0 on the Freescale MPC8313E RDB board

#######################################################################
## SERIAL driver
#######################################################################
devc-ser8250 -e -F -c166000000 -b115200 0xe0004500,0x09 0xe0004600,0x0A 
waitfor /dev/ser1
reopen /dev/ser1

slogger
pipe

#######################################################################
## Network driver
#
## Please note:
#<1>  the Vitesse switch firmware must first be loaded before the QNX image is run. This must be done after every reset of the board. 
# Add the following to the U-boot environment:
# setenv ldswitch 'cp.b fe710000 40000 11000; go 40004'
# setenv bootcmd 'tftpboot $loadaddr $bootfile; run ldswitch; go $loadaddr'
#
# <2>tsec0 must always be forced to GigE because of a known issue with the Vitesse chip.
#ifconfig tsec0 media 1000BaseT mediaopt full-duplex
# 
# This procedure is explained in the Freescale MPC8313E-RDB BSP User's Manual.
#
#######################################################################
# To start the driver on TSEC0 (five 10/100/100 BaseT RJ-45 interface using Vitesse VSC7385 L2 switch) and
# on TSEC1 (one 10/100/100 BaseT RJ-45 interface using Marvell 88E1111 PHY)
display_msg starting TSEC0
io-pkt-v4 -dmpc85xx pci=0,syspage,emu_phy=0,irq_tx=32,irq_rx=33,irq_err=34 
display_msg starting TSEC1
io-pkt-v4 -d mpc85xx pci=1,ioport=0xe0025000,irq_tx=35,irq_rx=36,irq_err=37
display_msg starting TSEC0 and TSEC1
io-pkt-v4 -dmpc85xx pci=0,syspage,emu_phy=0,irq_tx=32,irq_rx=33,irq_err=34 -d mpc85xx pci=1,ioport=0xe0025000,irq_tx=35,irq_rx=36,irq_err=37
#io-pkt-v4 -dmpc85xx pci=0,syspage,emu_phy=0,irq_tx=32,irq_rx=33,irq_err=34 -pttcpip -d mpc85xx pci=1,ioport=0xe0025000,irq_tx=35,irq_rx=36,irq_err=37 -pttcpip

#ifconfig tsec0 1.2.3.4
#ifconfig tsec1 192.168.0.80
dhcp.client tsec1

#io-pkt-v4 -d mpc85xx pci=1,ioport=0xe0025000,irq_tx=35,irq_rx=36,irq_err=37
#ifconfig tsec0 192.168.0.80

#tcp/ip
#io-net -d mpc85xx -p ttcpip if=ndi0:192.168.0.80 &
waitfor /dev/socket
inetd &  

#######################################################################
## REMOTE_DEBUG (gdb or Momentics)
##  - refer to the help documentation for the gdb, qconn and the IDE
##    for more information on remote debugging
##  - the commands shown require that NETWORK is enabled too
#######################################################################
devc-pty
waitfor /dev/ptyp0 4
waitfor /dev/socket 4
qconn port=8000

#######################################################################
## NOR FLASH driver
#######################################################################
#display_msg Starting flash driver...
devf-generic -s 0xFE000000,8M

#######################################################################
## NAND FLASH driver
##  - supports 1 bank of NAND flash (32 MB), selected by the
##    'cs=x' driver-specific option, where x=0,1 are the allowable
##    values.
#######################################################################
#display_msg Starting ETFS driver for NAND flash...
#fs-etfs-mpc8313erdb512 -D cs=1 -m /fs/etfs

#######################################################################
## USB driver
#######################################################################
#display_msg Starting USB driver...
#io-usb -d ehci-8313 ioport=0xe0023100,irq=38 &
#waitfor /dev/io-usb/io-usb 4

#######################################################################
## I2C driver
#######################################################################
#display_msg Starting i2c driver...

# For I2C channel 1
#i2c-mpc5200 -p0xe0003000 -c88000000 -i14 --u1
# For I2C channel 2 
#i2c-mpc5200 -p0xe0003100 -c88000000 -i15 --u0


#######################################################################
## SPI driver
#######################################################################
#display_msg Starting SPI driver...

#spi-master -d mpc8349

#######################################################################
## PCI server
#######################################################################
#display_msg Starting PCI server...

#pci-mpc8313 &
#waitfor /dev/pci 4

#######################################################################
## These env variables are inherited by all the programs which follow
#######################################################################
SYSNAME=nto
TERM=qansi
HOME=/
PATH=:/proc/boot:/bin:/usr/bin:/opt/bin
LD_LIBRARY_PATH=:/proc/boot:/lib:/usr/lib:/lib/dll:/opt/lib

[+session] ksh &

}

[type=link] /bin/sh=/proc/boot/ksh
[type=link] /dev/console=/dev/ser1
[type=link] /tmp=/dev/shmem

libc.so

this link is required for debugging

[type=link] /usr/lib/ldqnx.so.2=/proc/boot/libc.so
#[type=link] /bin/telnetd=/proc/boot/telnetd

###########################################################################

uncomment for NETWORK driver

###########################################################################
devnp-mpc85xx.so
libsocket.so

[data=c]
devc-ser8250

###########################################################################

uncomment for NETWORK driver

###########################################################################
io-pkt-v4
nicinfo
ifconfig
ping
cat
netstat
fs-cifs
ftp
dhcp.client
io-net

###########################################################################

uncomment for REMOTE_DEBUG (gdb or Momentics)

###########################################################################
devc-pty
qconn
/usr/bin/pdebug=pdebug

###########################################################################

uncomment for NOR FLASH driver

###########################################################################
devf-generic
flashctl

###########################################################################

general commands

###########################################################################
ls
cp
ksh
pipe
pidin
uname
slogger
sloginfo
slay
mount
umount
shutdown
kill

find
inetd
telnet
telnetd
vi
ps

/etc/hosts = {
127.0.0.1 localhost
}

/etc/services = {
ftp 21/tcp
telnet 23/tcp
finger 79/tcp
pdebug 8000/tcp
}

/etc/inetd.conf = {
ftp stream tcp nowait root /bin/fdtpd fdtpd
telnet stream tcp nowait root /bin/telnetd telnetd
finger stream tcp nowait root /bin fingerd
pdebug stream tcp nowait root /bin/pdebug pdebug -
}

Just a quick guess:

I think you need to change these paths from /bin to /proc/boot since you appear to not have a harddrive and are running everything from the boot image.

Or setup links as you did here

Tim

Thanks, I had sort of figured that out by I am newby so good to have the confirmation. My post took over 8 hours to appear or I would have updated it. Since I posted I have realised that telnetd does not appear in the process list after boot, inetd is there. If I slay inetd I can start telnetd (with telnetd -4 -debug &) but I still cannot telnet into the QNX target. I have been able to telnet and ftp from QNX to Windows. Are there any other files etc I need to create on the target for telnet to work, e.g. password files etc, the only ones I have are the ones shown in the script. Also I never mentioned I can ping from QNX to Windows and vice versa.

Aboyd,

inetd spawns telentd ‘as needed’. That’s why after booting you only see inetd and not telnet running. But when you attempt to telnet in from windows you should see the telnet process running.

Yes, you will need password files other wise there won’t be any way for telnet to login. The files you need are passwd, opasswd, shadow and oshadow located in the /etc directory.

Tim

And devc.pty

Tim/Mario,

Thanks for you responses, after a rather long delay I am back to looking at this. At present I am trying to create a user account/password combination which will hopefully resolve my issues with telnet.

My platform does not have hard disk but I do have a NOR flash mapped as fs0p1. Until I can get things working I have create symlinks for the passwd files as follows:

[type=link] /etc/passwd=/fs0p1/etc/passwd
[type=link] /etc/opasswd=/fs0p1/etc/opasswd
[type=link] /etc/shadow=/fs0p1/etc/shadow
[type=link] /etc/oshadow=/fs0p1/etc/oshadow
[type=link] /etc/group=/fs0p1/etc/group
[type=link] /etc/.pwlock=/fs0p1/etc/.pwlock

If I run passwd I am prompted to enter all the required details, I then receive message “unable to create password entry”. I can see that passwd has create the home directory requested I can also see that file /fs0p1/etc/.pwlock has been created by passwd (also note I have been deleting .pwlock file before retrying).

Do you have any idea what the problem could be? I suspect the issue may be down to the fact I do not have a hardisk and I need to symlink more things to my NOR flash.

One problem is that you have included telnetd in your image at /proc/boot (default) and you have commented the symlink…

#[type=link] /bin/telnetd=/proc/boot/telnetd

So when telnet tries to connect, inetd goes to /etc/inetd.conf and finds…

telnet stream tcp nowait root /bin/telnetd telnetd

There is no /bin/telnetd - immediate error message!

Also, before you get wrapped up in the complexities of “shadow” files, create this /etc/passwd file and test your image. It will allow root to telnet in without a password.

root::0:0:Superuser:/root:/bin/sh
ftp::0:0:FTP User:/:/bin/sh

You should also look at adding /usr/lib/terminfo/q/qansi (or whatever matches your TERM=) if you want to use “vi”.

denkelly,

Using your root password file I have been able to telnet succesfully, thanks :stuck_out_tongue:

Based on the my description in my previous post do you have any advice on getting the passwd utility working correctly? I am seriously stuck with this!!

Also I presume the password file will allow me to ftp in as user ftp, no password? I have added the ftpd and can see it starting when I try and login. Just off to read more about ftp now.

Thanks.

You need non-volatile storage of passwords? Hopefully not changing too often.

If you setup a ramdisk and mount it at /etc, then /etc/shadow,/etc/opasswd and /etc/.pwlock can be written. You just need to “seed” /etc/passwd and /etc/shadow from the etfs flash filesystem… and write them back to etfs when changed! (You could probably write a process to check periodically if /etc/passwd or /etc/shadow has changed, and write the updated files to etfs?)

Sample ramdisk script… (may have to alter “hd0” !!!)

# create 4M ramdisk /dev/hd0t77 - capacity is in sectors
devb-ram ram capacity=8192 &
waitfor /dev/hd0
# must dinit (format) and then mount
dinit -hq /dev/hd0t77
mount /dev/hd0t77 /etc

For ftp, you will need /etc/ftpusers.

Really all I am looking to do is create one username/password combination and once it is created it can be placed in my build script, i.e. as follows:

[b]/etc/passwd= {
aboyd:x:101:1:ab:/fs0p1/aboyd:/bin/sh
}

/etc/shadow= {
aboyd::0:0
}[/b]

I retried using my nor flash today (fs0p1) and was able to generate passwords for my username and also for root (I have no idea why this would not work yesterday). I found however on adding these passwd/shadow files to my build script I could telnet in, enter username and password, it would log me in then immedietley kick me out. The same happened for root/aboyd. At this point my build script was generating passwd/shadow (that were previously created on fs0p1) as follows:

[b]/etc/passwd= {
root:x:100:1:root:/fs0p1/root:/bin/sh
aboyd:x:101:1:ab:/fs0p1/aboyd:/bin/sh
}

/etc/shadow= {
root:::0:0
aboyd::0:0
}[/b]

Bit confused here I had expected this to work?

I also tried to create the ramdisk as you suggested, on doing “devb-ram ram capacity=8192 &” on the command line I get:

Path=0 -
target=0 lun=0 Direct-Access(0) - ram Rev:

As far as I can see this is correct, I can see devb-ram is running but if I look in /dev I have no hd(n) listed. I can start my NOR flash driver at runtime and it adds the fs0/fs0p1/fs02 entries in /dev so not sure what is going wrong here?

Really all I am looking to do is create one username/password combination and once it is created it can be placed in my build script

Well, it that’s all you need, login to a VMware session and create the user/password you desire!

I can see devb-ram is running but if I look in /dev I have no hd(n) listed.

I have never seen devb-ram fail but it does require libcam.so, io-blk.so and cam-disk.so. However if you use static passwords, there is no need to write /etc/shadow … right?

could telnet in, enter username and password, it would log me in then immedietley kick me out.
Not sure here. Have you added /usr/lib/terminfo/q/qansi to satisfy TERM=qansi" ?

Hi,

I am stuck with a similar problem, where m having ifs image running in my device and i connect my device using telnet. I want to create a new user with a new password but when i try passwd utility to create new user this give me below error
“Unable to lock password database (No such file or directory)”

I m using ifs image which is only readable, is there is any way i can create new user as i don’t want to change image type. I am trying symlinks but still confused for this.

Ashi

Ashi,

You can create a temporary user. One that will exist only as long as your device is booted. But one it resets the user will be gone.

The reason is because your ifs image is read-only (unless you also have a hard drive / compact flash drive).

Is that all you need to do?

Tim

Tim,

no, i need a permanent user which will exist even if my device is rebooted. I tried using symbolic links for passwd and related files but that has not solved my problem :frowning:

Also can u pls tell me how we can create a temporary user ?

I have a flash drive where i can create files at run time…is there is any way if we can port /etc or passwd related files in my editable flash drive ?

Ashi

Which syntax did you use ?

ln -sP Target LinkName

i have created symlink for files used for passwd like, passwd, shadow, opasswd, oshadow, group but this doesnt work.

Ashi

There might be a permission problem.

You can try the following :

  • Create a directory called “etc” on your flash drive : mkdir /my_flash_drive/etc
  • Copy “/etc” content to the newly created directory : cp -r /etc /my_flash_drive/etc
  • Redirect “/etc” on the newly created directory : ln -sP /my_flash_drive/etc /etc
  • Create user and password
  • Copy “/etc/shadow” and “/etc/passwd” in your BSP sources files (in “prebuilt” directory).
  • Regenerate your BSP

Thanks, i tried this and it worked :slight_smile:

Thank you for your support.

Ashi

You’re welcome :slight_smile:

I have a flash drive where i can create files at run time…is there is any way if we can port /etc or passwd related files in my editable flash drive ?

Sure. Assuming you have created the /etc folder on the flash drive (as you want it), just mount the flash drive at /.