# Is there a way to apply sudo to specific serial port? Otherwise can not open

**URL:** <https://discourse.nodered.org/t/is-there-a-way-to-apply-sudo-to-specific-serial-port-otherwise-can-not-open/70016>\
**Category:** General\
**Created:** [3 November 2022 11:51 UTC](https://discourse.nodered.org/t/is-there-a-way-to-apply-sudo-to-specific-serial-port-otherwise-can-not-open/70016 "2022-11-03T11:51:18Z")\
**Posts on this page:** 1\
**Showing post:** 19

<div class="post-metadata">

**Author:** ![rxunique](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rxunique/32/70140_2.png) [@rxunique](https://discourse.nodered.org/u/rxunique)\
**Post date:** [20 November 2022 22:40 UTC](https://discourse.nodered.org/t/is-there-a-way-to-apply-sudo-to-specific-serial-port-otherwise-can-not-open/70016/19 "2022-11-20T22:40:08Z")

</div>

@TotallyInformation Can I trouble you again? I did notice ttyUSBx can change quite often, but I found even `ls -l /dev/serial/by-id/` can output different device IDs

Mostly I get this

```auto
$ ls -l /dev/serial/by-id/
total 0
lrwxrwxrwx 1 root root 13 Nov 14 08:54 usb-SimTech __Incorporated_SimTech__ Incorporated_0123456789ABCDEF-if02-port0 -> ../../ttyUSB0
lrwxrwxrwx 1 root root 13 Nov 14 08:54 usb-SimTech __Incorporated_SimTech__ Incorporated_0123456789ABCDEF-if03-port0 -> ../../ttyUSB1
lrwxrwxrwx 1 root root 13 Nov 14 08:54 usb-SimTech __Incorporated_SimTech__ Incorporated_0123456789ABCDEF-if04-port0 -> ../../ttyUSB3
lrwxrwxrwx 1 root root 13 Nov 14 08:54 usb-SimTech __Incorporated_SimTech__ Incorporated_0123456789ABCDEF-if05-port0 -> ../../ttyUSB4
lrwxrwxrwx 1 root root 13 Nov 14 08:54 usb-SimTech __Incorporated_SimTech__ Incorporated_0123456789ABCDEF-if06-port0 -> ../../ttyUSB5

```

But some time I get this

```auto
$ ls -l /dev/serial/by-id/
total 0
lrwxrwxrwx 1 root root 13 Nov 21 08:50 usb-SimTech __Incorporated_SimTech__ Incorporated-if02-port0 -> ../../ttyUSB0
lrwxrwxrwx 1 root root 13 Nov 21 08:50 usb-SimTech __Incorporated_SimTech__ Incorporated-if03-port0 -> ../../ttyUSB2
lrwxrwxrwx 1 root root 13 Nov 21 08:50 usb-SimTech __Incorporated_SimTech__ Incorporated-if04-port0 -> ../../ttyUSB3
lrwxrwxrwx 1 root root 13 Nov 21 08:50 usb-SimTech __Incorporated_SimTech__ Incorporated-if05-port0 -> ../../ttyUSB4
lrwxrwxrwx 1 root root 13 Nov 21 08:50 usb-SimTech __Incorporated_SimTech__ Incorporated-if06-port0 -> ../../ttyUSB5

```

I did some search that there's no way to force a static device ID in linux, so is my only way out write a bit of script to dynamically get the ID?

if so, how do I go about setting port name dynamically in Node-Red, this post says its impossible

> [@How to dynamically provide port name in serialrequest node](https://discourse.nodered.org/t/how-to-dynamically-provide-port-name-in-serialrequest-node/34338):
>
> I'm trying to dynamically enter com details for a serial port. While msg.baudrate is working while injected. Msg.port cannot be injected into the node. Serial port details if not explicitly mentioned in the serial request node when deployed is showing type error. Is my approach correct or is it not possible to implement dynamic msg.port config

---

_[View the full topic](https://discourse.nodered.org/t/is-there-a-way-to-apply-sudo-to-specific-serial-port-otherwise-can-not-open/70016)._
