How to reset webgui port via ssh

Status
Not open for further replies.

nikkpap

Cadet
Joined
Jun 14, 2017
Messages
7
Hi i am new to Freenas and i am exieded . I made a mistake accidently put the same port to webgui as my ssh one
Now i am able to connect via ssh but not with wegui (lol) , my question is can i somehow reset webgui port to 80 or put an other port via ssh. I dont want to lose any data or other configuration.

Thanks a lot .
 

BigDave

FreeNAS Enthusiast
Joined
Oct 6, 2013
Messages
2,479
  1. Which version of FreeNAS are you running
  2. Do you know what port number you switched to?
  3. Was the change in port number done from the CLI or the GUI?
 

nikkpap

Cadet
Joined
Jun 14, 2017
Messages
7
1
Last login: Thu Jun 15 08:38:17 2017 from 192.168.1.10
FreeBSD 10.3-STABLE (FreeNAS.amd64) #0 41eb257(9.10.2-STABLE): Mon Mar 6 17:03:14 UTC 2017

FreeNAS (c) 2009-2016, The FreeNAS Development Team
All rights reserved.
FreeNAS is released under the modified BSD license.

For more information, documentation, help or support, go here:
http://freenas.org

FreeBSD vafnas.local 10.3-STABLE FreeBSD 10.3-STABLE #0 41eb257(9.10.2-STABLE): Mon Mar 6 17:03:14 UTC 2017 root@gauntlet:/freenas-9.10-releng/_BE/objs/freenas-9.10-releng/_BE/os/sys/FreeNAS.amd64 amd64

2. 20202

3. from gui

thanks
 

nikkpap

Cadet
Joined
Jun 14, 2017
Messages
7
no i dont want this ... it will be a way to do it from ssh , i have access even it has the same port with gui .... so i need to edit a file ?
 
D

dlavigne

Guest
Do you have a saved config from before you changed the port? If so, you could restore that afterwards. If not, it would be an SQL command and you would have to know the name of the field in the database to edit. I don't know either the field name or the SQL command to modify it.
 

nikkpap

Cadet
Joined
Jun 14, 2017
Messages
7
Are you willing to try ? please search it As i can see you are

Administrator

Moderator

iXsystems

thanks
 
D

dlavigne

Guest
I have no idea. Someone else might or you may be stuck finding an older config or recreating one.
 

nikkpap

Cadet
Joined
Jun 14, 2017
Messages
7
found it with your tip ---- > freenas-v1.db <----- thanks
if i edit the db and change the setting can i replace the file and reboot the NAS ?
It will work or i will lose everything ?

btw
f418n4.png
 

Artion

Patron
Joined
Feb 12, 2016
Messages
331
This could help. Search for the port setting.
 

nikkpap

Cadet
Joined
Jun 14, 2017
Messages
7
found it with your tip ---- > freenas-v1.db <----- thanks
if i edit the db and change the setting can i replace the file and reboot the NAS ?
It will work or i will lose everything ?

btw
f418n4.png
my solution works very well you need you need <<WinSCP>> for transfering the "freenas-v1.db" and you <<DB Browser for SQLite>> to edit the the file dont forget to to write changes to db from file -> write changes (ctrl+s) . then use again winscp to sent the file back

finally reboot from putty with shutdown -r now...... wait to boot and you are READY to GO ...

Advanced way

for the terminal "geeks" : sqlite3 /data/freenas-v1.db "update system_settings set stg_guiport = '20202';" inside the ssh from putty or linux or mac

etc
port= 20202

thanks
 

VintageGold

Cadet
Joined
Mar 12, 2018
Messages
6
my solution works very well you need you need <<WinSCP>> for transfering the "freenas-v1.db" and you <<DB Browser for SQLite>> to edit the the file don't forget to to write changes to db from file -> write changes (ctrl+s) . then use again winscp to sent the file back

finally reboot from putty with shutdown -r now...... wait to boot and you are READY to GO ...

Advanced way

for the terminal "geeks" : sqlite3 /data/freenas-v1.db "update system_settings set stg_guiport = '20202';" inside the ssh from putty or linux or mac

etc
port= 20202

thanks
@nikkpap, this was a great solution, thank you for posting back so others could benefit from your experience. I had a similar issue and was able to resolve it with your help. I changed the GUI protocol from http to https on my server and had a certificate problem and couldn't access the Web GUI anymore.

I followed this process:
  1. Connect with WinSCP and copy freenas-v1.db from the /data directory to my local computer.
  2. Open freenas-v1.db with DB Browser for SQLite - http://sqlitebrowser.org/
  3. Find the system_settings table, right click and select Browse Table. This was really useful to see the name of the setting entry and its values. I wouldn't have known what to edit without doing this.
  4. Edit the stg_guiprotocol entry from https to http.
  5. Write Changes (Ctrl+S)
  6. Copy the file back to the /data folder and overwrite.
  7. Reboot from SSH
After playing with this process and understanding what table I needed to look for and what entry I needed to change, I also tried this via command line and modified the terminal command above to edit the stg_guiprotocol setting directly using this command:

Code:
sqlite3 /data/freenas-v1.db "update system_settings set stg_guiprotocol = 'http';"

I learned later (by accident) there was a page from iX Systems dealing with my exact issue, should anyone else find it useful.
https://www.ixsystems.com/blog/library/recover-invalid-certificate/
 
Last edited:
Status
Not open for further replies.
Top