I have a Centos 7 server with 48 USB to serial devices plugged into it. Using udev, I was able to write a script that creates symlinks in the /dev folder that map the ttyUSBx devices to corresponding ttyDy names, based on the serial number of the device. I then run an instance of agetty on the ttyDy device files.

The problem is, when I log in from a remote terminal, the tty command outputs the name of the root ttyUSB device, and not the ttyD symlink I created (also, ps -e will output my ttyUSB port as the tty of the bash shell). Is there a command I can run as part of my .bashrc, or an argument sent to login or agetty that will allow me to change the name of my tty to my static ttyD port?

  • Try a hard link instead of a symlink. – Stéphane Chazelas Jan 21 '16 at 13:44
  • I set up the hard link manually, and it looks like that sorted it out. Thanks. – Darth Andy Samberg Jan 21 '16 at 13:58
  • just be aware that deleting the hard link deletes both nodes. – Wyatt Ward Jan 21 '16 at 15:05

This was answered already in a comment but I'm going to post it as an answer since the original answerer did not.

You will want to hard link to the device nodes instead of symbolic linking. Just be aware that deleting the hard link will delete the device node as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.