Error need to or from clause

I am using Ubuntu 20.04.3 LTS, although this question is probably not specific to Ubuntu but to any system using ufw. I am setting up a rule for VNC vino connections. I meant to do that via a confi...

I am using Ubuntu 20.04.3 LTS, although this question is probably not specific to Ubuntu but to any system using ufw.
I am setting up a rule for VNC vino connections.
I meant to do that via a configured app.
I created /etc/ufw/applications.d/vino-server with the following contents

[Vino Server]
title = “Vino VNC Server”
description = “Vino - Default Ubuntu VNC server”
ports=5900,5901/tcp

and then

$ sudo ufw allow app "Vino Server" from 192.168.0.0/24
ERROR: Need 'from' or 'to' with 'app'

How can I solve this error?

I executed then

$ sudo ufw allow from 192.168.0.0/24 proto tcp to any port 5900

which added one line to the ufw status (see below), and finally allowed connection via remmina. So it seems I am ok to connect, and only missing the app-way configuration/allowing.

$ sudo nmap localhost
Starting Nmap 7.80 ( https://nmap.org ) at 2021-11-19 08:03 -03
Nmap scan report for localhost (127.0.0.1)
Host is up (0.0000070s latency).
Not shown: 997 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
631/tcp  open  ipp
5900/tcp open  vnc

Nmap done: 1 IP address (1 host up) scanned in 0.18 seconds

$ sudo ufw status verbose
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW IN    Anywhere                  
5900/tcp                   ALLOW IN    192.168.0.0/24      <--- THIS LINE ADDED    
22/tcp (v6)                ALLOW IN    Anywhere (v6)             

$ sudo ss -ltnp
State        Recv-Q       Send-Q             Local Address:Port              Peer Address:Port       Process                                          
LISTEN       0            5                      127.0.0.1:631                    0.0.0.0:*           users:(("cupsd",pid=727,fd=7))                  
LISTEN       0            128                    127.0.0.1:6010                   0.0.0.0:*           users:(("sshd",pid=9845,fd=11))                 
LISTEN       0            5                        0.0.0.0:5900                   0.0.0.0:*           users:(("vino-server",pid=6594,fd=12))          
LISTEN       0            4096               127.0.0.53%lo:53                     0.0.0.0:*           users:(("systemd-resolve",pid=704,fd=13))       
LISTEN       0            128                      0.0.0.0:22                     0.0.0.0:*           users:(("sshd",pid=7138,fd=3))                  
LISTEN       0            5                          [::1]:631                       [::]:*           users:(("cupsd",pid=727,fd=6))                  
LISTEN       0            128                        [::1]:6010                      [::]:*           users:(("sshd",pid=9845,fd=10))                 
LISTEN       0            5                           [::]:5900                      [::]:*           users:(("vino-server",pid=6594,fd=11))          
LISTEN       0            128                         [::]:22                        [::]:*           users:(("sshd",pid=7138,fd=4))

Содержание

  1. Thread: UFW question
  2. UFW question
  3. Re: UFW question
  4. Re: UFW question
  5. Re: UFW question
  6. Re: UFW question
  7. Re: UFW question
  8. Re: UFW question
  9. Re: UFW question
  10. Database.Guide
  11. Beginners
  12. Categories
  13. Fix “ERROR: missing FROM-clause entry for table” in PostgreSQL when using UNION, EXCEPT, or INTERSECT
  14. Example of Error
  15. Solution 1
  16. Solution 2
  17. Missing FROM-clause entry for table « », что делать?

Thread: UFW question

Thread Tools
Display

UFW question

# ufw status
Status: active

To Action From
— —— —-
22 DENY Anywhere
Apache DENY Anywhere
80 ALLOW 10.206.20.0/24

As one can see, te deny from everywhere to Apache messes with rule 3, the allow to port 80.

How can I either:

1) delete rule 2 and rule 3
2) add a rule for app Apache that allows from 10.206.20.0/24

Many thanks in advance.
z

PS. No, I don’t want to use another firewall. iptables is fine.

Re: UFW question

Found out how to delete rule 3:

# ufw delete allow from 10.206.20.0/24 to any port 80
Rule deleted

Still cannot work out the app rule:
# ufw delete deny app apache
ERROR: Need ‘to’ or ‘from’ clause
# ufw delete deny app Apache
ERROR: Need ‘to’ or ‘from’ clause
# ufw delete deny app Apache to any port
ERROR: Wrong number of arguments

Re: UFW question

install GUFW for a grahical interface as it is easier to remove and add rules for UFW imo

Re: UFW question

I did anticipate you reply.

Sorry, when I wrote: PS. No, I don’t want to use another firewall. iptables is fine. I also meant to cover GUIs as well.

Let me add.
i) X is not installed.
ii) These is a headless server.

Re: UFW question

Sorry my assistance was not what you wanted

Re: UFW question

Out of hope, I added the gufw to the server and Xdisplayed it back to another PC. GUFW cannot remove the rule. One can select the rule and try and delete it but the message «error performing operation» is given.

As a workaround, I ran:
ufw allow Apache

and this dropped the deny rule so at least it is allowed. However, I think I shall steer away from ufw and use iptables directly. At least I shall have full control over what it does and I can confidently add and delete rules.

Re: UFW question

Since ufw is (reportedly) a front end for iptables, I presume you should still be able to edit the iptables rules directly. Good Luck!

Re: UFW question

Hmmm. from looking at the tutorial here, it looks like your syntax is a tad off.

Источник

Database.Guide

Beginners

Categories

  • Azure SQL Edge (16)
  • Database Concepts (48)
  • Database Tools (70)
  • DBMS (8)
  • MariaDB (420)
  • Microsoft Access (17)
  • MongoDB (265)
  • MySQL (375)
  • NoSQL (7)
  • Oracle (296)
  • PostgreSQL (255)
  • Redis (185)
  • SQL (588)
  • SQL Server (888)
  • SQLite (235)

Fix “ERROR: missing FROM-clause entry for table” in PostgreSQL when using UNION, EXCEPT, or INTERSECT

If you’re getting “ERROR: missing FROM-clause entry for table” in PostgreSQL when using an operator such as UNION , INTERSECT , or EXCEPT , it could be because you’re qualifying a column name with its table name.

To fix this, either remove the table name or use a column alias.

Example of Error

Here’s an example of code that produces the error:

In this case I tried to order the results by the TeacherName column, but I qualified that column with the table name (I used Teachers.TeacherName to reference the column name).

Referencing tables like this doesn’t work when ordering the results of UNION , EXCEPT , or INTERSECT .

Solution 1

One way to fix this issue is to remove the table name from the ORDER BY clause:

Solution 2

Another way to fix it is to use an alias for the column:

With this option, we assign an alias to the column, and then reference that alias in the ORDER BY clause.

Источник

Missing FROM-clause entry for table « », что делать?

  • Вопрос задан более двух лет назад
  • 3618 просмотров

Простой 4 комментария

В FROM нужно указать таблицу teterika.users и условие связи с таблицей teterika.lessons.
если условие не указать, то свяжется каждая строка одной таблицы с каждой строкой другой таблицы, получится декартово произведение таблиц.

Кстати, ваш запрос не имеет смысла, потому что из teterika.users.role у вас извлечется только запись ‘tutor’ в соответствии с условием. Т.е. ваш запрос можно заменить на:

Разве что вам действительно нужно получить декартово произведение всех уроков со всеми учителями.

А как это называется,когда после запятой в select указывается условие ‘tutor’ ,этому есть название?

И кстати,мне и нужно извлечь только записи с ‘tutor’ , у меня их определённое количество

И ещё ,если моя команда находится долго в процессе обработки и не выводит мой запрос на экран,о чём это может говорить?

gowwa123, когда в SELECT указывается не имя поля, а конкретное значение, строковое или числовое, это называется константа. И это приводит к тому, что в выборку добавиться колонка, в которой, по каждой строке будет это значение.

И ещё ,если моя команда находится долго в процессе обработки и не выводит мой запрос на экран, о чём это может говорить?

Это может говорить о том, что выборка получается очень большая.

Давайте мы с вами поступим иначе. Вы опишите здесь, структуру ваших таблиц. И объясните, какую конкретно выборку надо получить. А я попробую посоветовать вам правильный запрос.

Источник

  1. Hi,

    On system :

    # ufw status
    Status: active

    To Action From
    — —— —-
    22 DENY Anywhere
    Apache DENY Anywhere
    80 ALLOW 10.206.20.0/24

    As one can see, te deny from everywhere to Apache messes with rule 3, the allow to port 80.

    How can I either:

    1) delete rule 2 and rule 3
    2) add a rule for app Apache that allows from 10.206.20.0/24

    Many thanks in advance.
    z

    PS. No, I don’t want to use another firewall. iptables is fine.


  2. Re: UFW question

    Found out how to delete rule 3:

    # ufw delete allow from 10.206.20.0/24 to any port 80
    Rule deleted

    Still cannot work out the app rule:
    # ufw delete deny app apache
    ERROR: Need ‘to’ or ‘from’ clause
    # ufw delete deny app Apache
    ERROR: Need ‘to’ or ‘from’ clause
    # ufw delete deny app Apache to any port
    ERROR: Wrong number of arguments


  3. Re: UFW question

    install GUFW for a grahical interface as it is easier to remove and add rules for UFW imo


  4. Post Re: UFW question

    Quote Originally Posted by Fast_Wyvern
    View Post

    install GUFW for a grahical interface as it is easier to remove and add rules for UFW imo

    I did anticipate you reply…

    Sorry, when I wrote: PS. No, I don’t want to use another firewall. iptables is fine. I also meant to cover GUIs as well.

    Let me add.
    i) X is not installed.
    ii) These is a headless server.


  5. Re: UFW question

    Sorry my assistance was not what you wanted


  6. Re: UFW question

    Out of hope, I added the gufw to the server and Xdisplayed it back to another PC. GUFW cannot remove the rule. One can select the rule and try and delete it but the message «error performing operation» is given.

    As a workaround, I ran:
    ufw allow Apache

    and this dropped the deny rule so at least it is allowed. However, I think I shall steer away from ufw and use iptables directly. At least I shall have full control over what it does and I can confidently add and delete rules.


  7. Re: UFW question

    Since ufw is (reportedly) a front end for iptables, I presume you should still be able to edit the iptables rules directly. Good Luck!


  8. Re: UFW question

    Hmmm… from looking at the tutorial here, it looks like your syntax is a tad off…

    Code:

    # sudo ufw allow Apache
    Rule added
    
    # ufw status
    Status: active
    
    To Action From
    – —— —-
    22 LIMIT Anywhere
    Apache ALLOW Anywhere
    
    # sudo ufw delete allow Apache
    Rule deleted
    
    # ufw status
    Status: active
    
    To Action From
    – —— —-
    22 LIMIT Anywhere


I’m following this instruction and got the following error when trying to firewall the client. How else can I use ufw to get the same network behavior?

aborns@nautilus:~$ sudo ufw deny out eth0 1:65535/tcp
ERROR: Need 'to' or 'from' clause

EDIT

aborns@nautilus:~$ sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
Anywhere                   DENY        10.0.0.0
10.0.0.0                   DENY        Anywhere

53/udp                     ALLOW OUT   Anywhere
3128/tcp                   ALLOW OUT   Anywhere
53/udp (v6)                ALLOW OUT   Anywhere (v6)
3128/tcp (v6)              ALLOW OUT   Anywhere (v6)

asked Mar 22, 2016 at 15:36

Stan's user avatar

StanStan

572 silver badges6 bronze badges

5

Not sure if that page is old and community/UFW page is better. one says:

Deny Access

Deny by specific IP

sudo ufw deny from

example:To block packets from 207.46.232.182:

sudo ufw deny from 207.46.232.182

Deny by specific port and IP address

sudo ufw deny from <ip address> to <protocol> port <port number>

example: deny ip address 192.168.0.1 access to port 22 for all
protocols

sudo ufw deny from 192.168.0.1 to any port 22

Syntax for ufw is …

sudo ufw [--dry-run] [delete] [insert NUM]  allow|deny|reject|limit  
[in|out on INTERFACE] [log|log-all] [proto protocol] 
[from ADDRESS [port PORT]][to ADDRESS [port PORT]]

From this I would believe you are missing a word before ADDRESS: «from» or «to». Since [port PORT] is inside [ from|to ADDRESS [port PORT]] you probably also are missing an ADDRESS.

answered Mar 22, 2016 at 15:57

Rinzwind's user avatar

RinzwindRinzwind

288k39 gold badges561 silver badges701 bronze badges

I’ve been trying to figure out how to update the ID of the newest person in my database for 36 hours. It moans about the clients in the FROM clause, but when I remove that clause, the update affects every ID in the whole database.

UPDATE clients SET ID = $id WHERE timestamp = (SELECT MAX(timestamp) FROM clients)

What am I doing wrong?

Pops's user avatar

Pops

29.8k37 gold badges133 silver badges151 bronze badges

asked Dec 13, 2011 at 22:09

WhiteFinger's user avatar

3

Replace it with

UPDATE clients SET ID = $id ORDER BY `timestamp` DESC LIMIT 1

PS: this query solves the original task specified in the question «to update the id of the newest person in my database»

answered Dec 13, 2011 at 22:12

zerkms's user avatar

zerkmszerkms

246k67 gold badges434 silver badges534 bronze badges

1

You can’t update a table using a WHERE condition aggregated from the exact same table.

perhaps you want this:

UPDATE
    client
SET
    client.[id] = $id
ORDER BY
    client.[timestamp] DESC
LIMIT 1

answered Dec 13, 2011 at 22:13

Matthew's user avatar

MatthewMatthew

10.2k5 gold badges48 silver badges101 bronze badges

2

Bug #715676 reported by
Marty
on 2011-02-09

This bug affects 1 person

Affects Status Importance Assigned to Milestone


ufw (Ubuntu)

Fix Released

Undecided


Unassigned

Bug Description

Binary package hint: ufw

I can’t find documentation on application profiles so please point me at them if they cover this.

Ubuntu 10.10 has a number of application profiles (SSH, Apache, Postfix etc.etc.). Some of them use names with spaces.

# ufw allow Apache Full
ERROR: Need ‘to’ or ‘from’ clause

There are a number of ways to approach this:

— discourage the use of spaces in the name

— document the need for quoting these names in the man page

— attempt to handle these names within ufw.

Related branches

Не уверенный, если та страница стара и community/UFW страница лучше. каждый говорит:

Запретите доступа

Отклоните определенным IP

sudo ufw отклоняют от

пакеты блока example:To от 207.46.232.182:

sudo ufw deny from 207.46.232.182

Отклоните определенным портом и IP-адресом

sudo ufw deny from <ip address> to <protocol> port <port number>

пример: запретите IP-адрес 192.168.0.1 доступа к порту 22 для всех протоколов

sudo ufw deny from 192.168.0.1 to any port 22

Синтаксис для ufw…

sudo ufw [--dry-run] [delete] [insert NUM]  allow|deny|reject|limit  
[in|out on INTERFACE] [log|log-all] [proto protocol] 
[from ADDRESS [port PORT]][to ADDRESS [port PORT]]

От этого я полагал бы, что Вы пропускаете слово перед АДРЕСОМ: «от» или «до». Начиная с [порта PORT] внутри [from|to АДРЕС [порт PORT]], Вы, вероятно, также пропускаете АДРЕС.

ответ дан Rinzwind
23 March 2016 в 06:35

поделиться

Понравилась статья? Поделить с друзьями:
  • Error need a single repository as argument
  • Error nck must be a 8 digit number yota
  • Error nc program does not contain any operations
  • Error nat tproxy lookup failed to locate original ips on local
  • Error nas introduced by coercion