Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to set a static port for rpc-statd w/ systemd [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
drifter
n00b
n00b


Joined: 14 Feb 2018
Posts: 3
Location: Canada

PostPosted: Fri Jul 20, 2018 6:13 pm    Post subject: How to set a static port for rpc-statd w/ systemd [SOLVED] Reply with quote

I've been scratching my head trying to figure this out.
I've edited /etc/conf.d/nfs and changed the ports there using the default: OPTS_RPC_STATD, and also STATDARGS, RPCSTATDARGS.
I've added and edited /etc/sysconfig/nfs according to the redhat and archlinux wiki, a long shot but no dice.
I'm able to set a static port by running # rpc.statd -p 1234, but having to stop and start rpc-statd after every boot is a pain.
I also had a problem setting a static port for mountd, but after adding an entry in /etc/services I got that working.
Is there a better way than that to set a static mountd port?
I tried adding an entry for statd in /etc/services but it made no difference. (tried using the name statd, rpc-statd)
I tried to find which variable was being used in the systemd unit files but didn't see any, would I be able to set one there and if so where and how?
I'm considering writing a script which grabs the ports I need for status from rpcinfo -p then updates the firewall accordingly, but that just seems like overkill.
Has anyone else had any luck setting static ports for statd and mountd under systemd?

Any help would be greatly appreciated.


Last edited by drifter on Sat Jul 21, 2018 5:24 am; edited 1 time in total
Back to top
View user's profile Send private message
mike155
Advocate
Advocate


Joined: 17 Sep 2010
Posts: 4438
Location: Frankfurt, Germany

PostPosted: Fri Jul 20, 2018 10:11 pm    Post subject: Reply with quote

You could try the steps below:

Code:
1) cp /lib/systemd/system/rpc-statd /etc/systemd/system

2) Edit /etc/systemd/system/rpc-statd and change the line

     ExecStart=/sbin/rpc.statd

     to

     ExecStart=/sbin/rpc.statd -p 1224

3) systemctl daemon-reload

4) systemctl restart rpc-statd.service

5) ps -fe | grep rpc.statd

     will now show:

     root      5346     1  0 00:00 ?        00:00:00 /sbin/rpc.statd -p 1234

If you want to revert the change: just delete file /etc/systemd/system/rpc-statd and perform steps 3, 4 and 5.
Back to top
View user's profile Send private message
drifter
n00b
n00b


Joined: 14 Feb 2018
Posts: 3
Location: Canada

PostPosted: Sat Jul 21, 2018 5:19 am    Post subject: Solved Reply with quote

Awesome! Thanks a bunch for your time and solution! That did the trick.
Back to top
View user's profile Send private message
mike155
Advocate
Advocate


Joined: 17 Sep 2010
Posts: 4438
Location: Frankfurt, Germany

PostPosted: Sat Jul 21, 2018 10:44 am    Post subject: Reply with quote

I'm glad that it works!

If you are not familiar with Systemd, you may want to go to https://www.freedesktop.org/software/systemd/man/systemd.unit.html an read section 'Example 2. Overriding vendor settings' (near the bottom of the page).
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum